DiJetAnalysis.cc

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <stdio.h>
00003 #include "HepMC/GenEvent.h"
00004 #include "HepMC/IO_GenEvent.h"
00005 #include "HepMC/GenParticle.h"
00006 #include "HepMC/GenVertex.h"
00007 #include "HepMC/IO_AsciiParticles.h"
00008 #include "HepMC/SimpleVector.h"
00009 #include "HepPDT/ParticleData.hh"
00010 #include "CLHEP/Vector/LorentzVector.h"
00011 
00012 using namespace std;
00013 
00014 // ROOT headers
00015 #include "TH1.h"
00016 #include "TH2.h"
00017 #include "TFile.h"
00018 #include "TMath.h"
00019 #include "TLorentzVector.h"
00020 
00021 #include "fastjet/PseudoJet.hh"
00022 #include "fastjet/ClusterSequence.hh"
00023 #include "fastjet/JetDefinition.hh"
00024 #include "fastjet/SISConePlugin.hh"
00025 
00026 //top analysis header
00027 #include "../include/DiJetAnalysis.h"
00028 
00029 //**********************
00030 
00031 /**
00032 Constructor
00033 */
00034 DiJetAnalysis::DiJetAnalysis()
00035 {
00036 }
00037 
00038 /**
00039 Destructor
00040 */
00041 DiJetAnalysis::~DiJetAnalysis()
00042 {
00043 }
00044 
00045 /**
00046 Before using the class initialize
00047 */
00048 int DiJetAnalysis::Init(double tr_max_eta, double tr_min_pt )
00049 {
00050   // specify default eta cut
00051   m_max_eta=tr_max_eta;  
00052   
00053   // specify default pt cut
00054   m_min_pt=tr_min_pt;  
00055    
00056   // default Output file name
00057   m_outputFileName="DiJetAnalysis.root";
00058   m_outputRootDir="DiJet";
00059   
00060   //declaration of histograms
00061   m_jet_count=baseAnalysis::initHist(string("jet_count"), string("Nr of Jets"), string("Nr Jets"),16, -0.5, 15.5);
00062   m_jet_pt=baseAnalysis::initHist(string("jet_pt"),string("Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 
00063                                  200, 0.,1000.);
00064   m_jet_pt_log=baseAnalysis::initHist(string("jet_pt_logscale"),string("Jet Transverse Momentum -logscale-"),
00065                                              string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00066   m_leadingjet_pt=baseAnalysis::initHist(string("leadingjet_pt"),string("Leading Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 
00067                                          200, 0.,1000.);
00068   m_leadingjet_pt_log=baseAnalysis::initHist(string("leadingjet_pt_logscale"),string("Leading Jet Transverse Momentum -logscale-"),
00069                                              string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00070   m_secondleadingjet_pt=baseAnalysis::initHist(string("secondleadingjet_pt"),string("Second leading Jet Transverse Momentum"),
00071                                                string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00072   m_secondleadingjet_pt_log=baseAnalysis::initHist(string("secondleadingjet_pt_logscale"),
00073                                                    string("Second leading Jet Transverse Momentum -logscale-"),
00074                                                    string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00075   
00076   m_jet_phi=baseAnalysis::initHist(string("jet_phi"),string("Jet Phi angle"),string("Jet #varphi"), 64, 0., 6.4);
00077   m_jet_eta=baseAnalysis::initHist(string("jet_eta"),string("Jet Pseudo rapidity"),string("Jet #eta"),60, -6., 6.);
00078   
00079   m_charged_particle_multiplicity=baseAnalysis::initHist(string("charged_particle_multiplicity"),string("Number of charged Particles in the Event with #eta <2.5 and p_{T}>0.5 GeV"),string("charged particle multiplicity"),50, 0., 500.);
00080 //   m_charged_particle_temp_pt= new TH1D("DiJet_charged_particle_mean_pt","temp histogramm",200,0,200.); 
00081   m_charged_particle_temp_pt=baseAnalysis::initHist(string("DiJet_charged_particle_mean_pt"),string("temp histogramm"),string("DiJet charged particle mean p_{T}"),200,0,200.); 
00082   m_charged_particle_pt=baseAnalysis::initHist("charged_particle_pt","p_{T} of charged particles with #eta <2.5 and p_{T}>0.5 GeV","p_{T}",25,0,25.); 
00083   m_charged_particle_pt_log=baseAnalysis::initHist("charged_particle_pt_logscale","p_{T} of charged particles with #eta <2.5 and p_{T}>0.5 GeV","p_{T}",25,0,25.); 
00084   m_charged_particle_mean_pt=baseAnalysis::initHist(string("charged_particle_mean_pt"),string("Average p_{T} charged Particles in the Event with #eta <2.5 and p_{T}>0.5 GeV"),string("charged particle #bar{p}_{T}"),50, 0., 10.);
00085   m_charged_particle_rms_pt=baseAnalysis::initHist(string("charged_particle_rms_pt"),string("RMS p_{T} charged Particles in the Event with #eta <2.5 and p_{T}>0.5 GeV"),string("charged particle #sigma(p_{T})"),50, 0., 10.);
00086   //m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),400, -400., 400.);
00087   
00088   m_jet_Deta_leadingJet_secondJet=baseAnalysis::initHist(string("jet_Deta_leadingJet_secondJet"),string("#Delta#eta leading and second leading Jet"),string("#Delta#eta"), 60, 0., 6.);
00089   m_jet_Dphi_leadingJet_secondJet=baseAnalysis::initHist(string("jet_Dphi_leadingJet_secondJet"),string("#Delta#varphi leading and second leading Jet"),string("#Delta#varphi"), 64, 0., 3.2);
00090   m_jet_DR_leadingJet_secondJet=baseAnalysis::initHist(string("jet_DR_leadingJet_secondJet"),string("#DeltaR leading and second leading Jet"),string("#DeltaR"), 60, 0., 15.);
00091   
00092   return true;
00093 }
00094 
00095 /**
00096 This is the main analysis function. 
00097 Search the particle, get their properties and the histograms.
00098 */
00099 int DiJetAnalysis::Process(HepMC::GenEvent* hepmcevt) 
00100 {
00101   // define some variables
00102   unsigned int chargeParticlecount=0;  
00103   
00104   // Reset the histogramm                        
00105   m_charged_particle_temp_pt->Reset();
00106   // Fill the eventnumber
00107   //m_evtnr->Fill((hepmcevt->event_number())%100);
00108   
00109   // loop over the particles and select pdgid and pt
00110   for ( HepMC::GenEvent::particle_const_iterator p =  hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p )
00111     {
00112       // use the pdg id to identify the particles
00113       int pid = (*p)->pdg_id();
00114       
00115       // we want stable charged particles
00116 
00117       // just remove the neutrinos, gammas and neutrons, ... from the
00118       // final state
00119       if(!chargedParticle(pid)) continue;
00120       
00121       // take all stable particles of this event
00122      if(!IsFinalStateParticle((*p))) continue;
00123 
00124       m_charged_particle_temp_pt->Fill((*p)->momentum().perp());
00125       m_charged_particle_pt->Fill((*p)->momentum().perp());
00126       m_charged_particle_pt_log->Fill((*p)->momentum().perp());
00127       chargeParticlecount++;
00128       //m_charged_particle_pdgID->Fill(pid);
00129     }
00130   
00131   // storage of input particles for jet
00132   CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00133   
00134   // check if jets were found
00135   //if(!m_inclusive_jets.size()) std::cout<<"DiJetAnalysis::no jets found"<<std::endl;
00136   
00137   //Fill the histograms
00138   m_jet_count->Fill(m_inclusive_jets.size());
00139   m_charged_particle_multiplicity->Fill(chargeParticlecount);
00140   m_charged_particle_mean_pt->Fill(m_charged_particle_temp_pt->GetMean());
00141   m_charged_particle_rms_pt->Fill(m_charged_particle_temp_pt->GetRMS());
00142   
00143   // not needed, but to be on the safe side
00144   m_charged_particle_temp_pt->Reset();
00145   
00146   if(m_inclusive_jets.size()){
00147 
00148     for(unsigned int  i=0; i<m_inclusive_jets.size(); i++) {
00149       m_jet_pt->Fill(m_inclusive_jets[i].perp());
00150       m_jet_pt_log->Fill(m_inclusive_jets[i].perp());
00151     }
00152 
00153     m_leadingjet_pt->Fill(m_inclusive_jets[0].perp());
00154     m_leadingjet_pt_log->Fill(m_inclusive_jets[0].perp());
00155     m_secondleadingjet_pt->Fill(m_inclusive_jets[1].perp());
00156     m_secondleadingjet_pt_log->Fill(m_inclusive_jets[1].perp());
00157     m_jet_phi->Fill(m_inclusive_jets[0].phi());
00158     m_jet_eta->Fill(m_inclusive_jets[0].eta());
00159     
00160     CLHEP::HepLorentzVector lv_firstJet(m_inclusive_jets[0].px(), m_inclusive_jets[0].py(), m_inclusive_jets[0].pz(), m_inclusive_jets[0].e());
00161     if(m_inclusive_jets.size() > 1 ) {
00162       CLHEP::HepLorentzVector lv_secondJet(m_inclusive_jets[1].px(), m_inclusive_jets[1].py(), m_inclusive_jets[1].pz(), m_inclusive_jets[1].e());   
00163       m_jet_DR_leadingJet_secondJet->Fill(fabs(lv_firstJet.deltaR(lv_secondJet)));
00164       m_jet_Deta_leadingJet_secondJet->Fill(fabs(lv_firstJet.eta()-lv_secondJet.eta()));
00165       m_jet_Dphi_leadingJet_secondJet->Fill(fabs(lv_firstJet.vect().deltaPhi(lv_secondJet.vect())));
00166     }
00167   }
00168   return true;
00169 }
00170 
00171 
00172 
00173 

Generated on Mon Jan 4 15:22:34 2010 for HepMCAnalysis by  doxygen 1.4.7