JetAnalysis.cc

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

Generated on Wed Aug 31 09:44:48 2011 for HepMCAnalysis by  doxygen 1.4.7