Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

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 /**
00040 Destructor: delete all the Pointer
00041 */
00042 DiJetAnalysis::~DiJetAnalysis()
00043 {
00044   while (!m_histVector.empty()){
00045     delete m_histVector.back();
00046     m_histVector.pop_back();
00047   }
00048 }
00049 
00050 /**
00051 Before using the class initialize
00052 */
00053 int DiJetAnalysis::Init(double tr_max_eta, double tr_min_pt )
00054 {
00055   
00056   // specify default eta cut
00057   m_max_eta=tr_max_eta;
00058   
00059   // specify default pt cut
00060   m_min_pt=tr_min_pt;
00061   
00062   // default Output file name
00063   m_outputFileName="DiJetAnalysis.root";
00064   m_outputRootDir="DiJet";
00065   
00066   //declaration of histograms
00067   m_jet_count=baseAnalysis::initHist(string("jet_count"), string("Nr of Jets"), string("Nr Jets"),16, -0.5, 15.5);
00068   //m_jet_pt=baseAnalysis::initHist(string("jet_pt"),string("Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 50, 0.,25.);
00069   //m_jet_pt_log=baseAnalysis::initHist(string("jet_pt_logscale"),string("Jet Transverse Momentum -logscale-"),string("Jet p_{T} [GeV]"), 50, 0.,50.);
00070   //m_jet_pt_high=baseAnalysis::initHist(string("jet_pt_high"),string("Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 50, 0.,150.);
00071   //m_jet_pt_high_log=baseAnalysis::initHist(string("jet_pt_high_logscale"),string("Jet Transverse Momentum -logscale-"),string("Jet p_{T} [GeV]"), 50, 0.,150.);
00072   m_jet_pt=baseAnalysis::initHist(string("jet_pt"),string("Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 
00073                                  50, 0.,150.);
00074   m_jet_pt_log=baseAnalysis::initHist(string("jet_pt_logscale"),string("Jet Transverse Momentum -logscale-"),
00075                                              string("Jet p_{T} [GeV]"), 50, 0.,150.);
00076   m_leadingjet_pt=baseAnalysis::initHist(string("leadingjet_pt"),string("Leading Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 
00077                                          50, 0.,150.);
00078   m_leadingjet_pt_log=baseAnalysis::initHist(string("leadingjet_pt_logscale"),string("Leading Jet Transverse Momentum -logscale-"),
00079                                              string("Jet p_{T} [GeV]"), 50, 0.,150.);
00080   m_secondleadingjet_pt=baseAnalysis::initHist(string("secondleadingjet_pt"),string("Second leading Jet Transverse Momentum"),
00081                                                string("Jet p_{T} [GeV]"), 50, 0.,150.);
00082   m_secondleadingjet_pt_log=baseAnalysis::initHist(string("secondleadingjet_pt_logscale"),
00083                                                    string("Second leading Jet Transverse Momentum -logscale-"),
00084                                                    string("Jet p_{T} [GeV]"), 50, 0.,150.);
00085   
00086   m_jet_phi=baseAnalysis::initHist(string("jet_phi"),string("Jet Phi angle"),string("Jet #varphi"), 64, 0., 6.4);
00087   m_jet_eta=baseAnalysis::initHist(string("jet_eta"),string("Jet Pseudo rapidity"),string("Jet #eta"),60, -6., 6.);
00088   
00089   m_charged_particle_multiplicity=baseAnalysis::initHist(string("charged_particle_multiplicity"),string("Number of charged Particles in the Event"),string("charged particle multiplicity"),100, 0., 1000.);
00090   m_charged_particle_temp_pt= new TH1D("DiJet_charged_particle_mean_pt","temp histogramm",200,0,200.); 
00091   m_charged_particle_pt=baseAnalysis::initHist("charged_particle_pt","p_{T} of charged particles","p_{T}",25,0,25.); 
00092   m_charged_particle_mean_pt=baseAnalysis::initHist(string("charged_particle_mean_pt"),string("Avarage p_{T} charged Particles in the Event"),string("charged particle #bar{p}_{T}"),50, 0., 10.);
00093   m_charged_particle_rms_pt=baseAnalysis::initHist(string("charged_particle_rms_pt"),string("RMS p_{T} charged Particles in the Event"),string("charged particle #sigma(p_{T})"),50, 0., 10.);
00094   //m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),400, -400., 400.);
00095   
00096   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.);
00097   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);
00098   m_jet_DR_leadingJet_secondJet=baseAnalysis::initHist(string("jet_DR_leadingJet_secondJet"),string("#DeltaR leading and second leading Jet"),string("#DeltaR"), 60, 0., 15.);
00099   
00100   for(unsigned int hist=0; hist< m_histVector.size(); hist++)
00101     {
00102       std::ostringstream counter_s;
00103       counter_s << hist;
00104       std::string histogram_name=m_outputRootDir;
00105       histogram_name+="_";
00106       histogram_name+=counter_s.str();
00107       histogram_name+="_";
00108       histogram_name+=m_histVector[hist]->GetName();
00109       m_histVector[hist]->SetName(histogram_name.c_str());
00110     }
00111   return SUCCESS;
00112 }
00113 
00114 /**
00115 This is the main analysis function. 
00116 Search the particle, get their properties and the histograms.
00117 */
00118 int DiJetAnalysis::Process(HepMC::GenEvent* hepmcevt) 
00119 {
00120   // define some variables
00121   unsigned int chargeParticlecount=0;  
00122   
00123   // Reset the histogramm                        
00124   m_charged_particle_temp_pt->Reset();
00125   // Fill the eventnumber
00126   //m_evtnr->Fill((hepmcevt->event_number())%100);
00127   
00128   // loop over the particles and select pdgid and pt
00129   for ( HepMC::GenEvent::particle_const_iterator p =  hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p )
00130     {
00131       // use the pdg id to identify the particles
00132       int pid = (*p)->pdg_id();
00133       
00134       // just remove the neutrinos, gammas and neutrons, ... from the
00135       // final state
00136       if(chargedParticle(pid)==NOTCHARGED) continue;
00137       
00138       // we want stable charged particles
00139       if (!((*p)->status() == 1)) continue;
00140       
00141       m_charged_particle_temp_pt->Fill((*p)->momentum().perp());
00142       m_charged_particle_pt->Fill((*p)->momentum().perp());
00143       chargeParticlecount++;
00144       //m_charged_particle_pdgID->Fill(pid);
00145     }
00146   
00147   // storage of input particles for jet
00148   CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00149   
00150   // run the jetfinder
00151   if(!m_inclusive_jets.size()) {
00152     int test = FindJet(hepmcevt);
00153     if(test<=0){
00154       cout <<"no jets found - return failure" << endl;
00155       //return FAILURE;
00156     }
00157   }
00158   
00159   //Fill the histograms
00160   m_jet_count->Fill(m_inclusive_jets.size());
00161   m_charged_particle_multiplicity->Fill(chargeParticlecount);
00162   m_charged_particle_mean_pt->Fill(m_charged_particle_temp_pt->GetMean());
00163   m_charged_particle_rms_pt->Fill(m_charged_particle_temp_pt->GetRMS());
00164   
00165   // not needed, but to be on the safe side
00166   m_charged_particle_temp_pt->Reset();
00167   
00168   if(m_inclusive_jets.size()){
00169 
00170     for(unsigned int  i=0; i<m_inclusive_jets.size(); i++) {
00171       m_jet_pt->Fill(m_inclusive_jets[i].perp());
00172       m_jet_pt_log->Fill(m_inclusive_jets[i].perp());
00173     }
00174 
00175     m_leadingjet_pt->Fill(m_inclusive_jets[0].perp());
00176     m_leadingjet_pt_log->Fill(m_inclusive_jets[0].perp());
00177     m_secondleadingjet_pt->Fill(m_inclusive_jets[1].perp());
00178     m_secondleadingjet_pt_log->Fill(m_inclusive_jets[1].perp());
00179     //m_jet_pt_high->Fill(m_inclusive_jets[0].perp());
00180     //m_jet_pt_high_log->Fill(m_inclusive_jets[0].perp());
00181     m_jet_phi->Fill(m_inclusive_jets[0].phi());
00182     m_jet_eta->Fill(m_inclusive_jets[0].eta());
00183     
00184     CLHEP::HepLorentzVector lv_firstJet(m_inclusive_jets[0].px(), m_inclusive_jets[0].py(), m_inclusive_jets[0].pz(), m_inclusive_jets[0].e());
00185     if(m_inclusive_jets.size() > 1 ) {
00186       CLHEP::HepLorentzVector lv_secondJet(m_inclusive_jets[1].px(), m_inclusive_jets[1].py(), m_inclusive_jets[1].pz(), m_inclusive_jets[1].e());   
00187       m_jet_DR_leadingJet_secondJet->Fill(abs(lv_firstJet.deltaR(lv_secondJet)));
00188       m_jet_Deta_leadingJet_secondJet->Fill(abs(lv_firstJet.eta()-lv_secondJet.eta()));
00189       m_jet_Dphi_leadingJet_secondJet->Fill(abs(lv_firstJet.vect().deltaPhi(lv_secondJet.vect())));
00190     }
00191   }
00192   return SUCCESS;
00193 }
00194 
00195 
00196 
00197 

Generated on Mon Feb 16 15:58:22 2009 for HepMCAnalysis by  doxygen 1.3.9.1