ZAnalysis.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/ZAnalysis.h"
00028 
00029 //**********************
00030 
00031 /**
00032 Constructor
00033 */
00034 ZAnalysis::ZAnalysis()
00035 {
00036 }
00037 
00038 /**
00039 Destructor
00040 */
00041 ZAnalysis::~ZAnalysis()
00042 {
00043 }
00044 
00045 /**
00046 Before using the class initialize
00047 */
00048 int ZAnalysis::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="ZBosonAnalysis.root";
00058   m_outputRootDir="Z";
00059   
00060   //declaration of histograms
00061   //m_evtnr=baseAnalysis::initHist(string("evtnr"),string("Event number"),string("Eventnumber"),1000, 0., 1000.);
00062   
00063   m_jet_count=baseAnalysis::initHist(string("jet_count"), string("Nr of Jets"), string("Nr Jets"),16, -0.5, 15.5);
00064   m_jet_pt=baseAnalysis::initHist(string("leadingjet_pt_high"),string("Leading Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00065   m_jet_pt_log=baseAnalysis::initHist(string("leadingjet_pt_high_logscale"),string("Leading Jet Transverse Momentum -logscale-"),string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00066   
00067   m_Z_count=baseAnalysis::initHist(string("Z_count"), string("Nr of Z-Bosons"), string("Nr Z-Boson"),16, -0.5, 15.5);
00068   m_Z_mass=baseAnalysis::initHist(string("Z_mass"),string("Z Mass"),string("m_{Z} [GeV]"), 80, 70., 110.);
00069   m_Z_mass_log=baseAnalysis::initHist(string("Z_mass_logscale"),string("Z Mass -logscale-"),string("m_{Z} [GeV]"), 80, 70., 110.);
00070   
00071   m_Z_pt_high=baseAnalysis::initHist(string("Z_pt_high"),string("Z Transverse Momentum"),string("Z p_{T} [GeV]"), 80, 0., 240.);
00072   m_Z_pt_high_log=baseAnalysis::initHist(string("Z_pt_high_logscale"),string("Z Transverse Momentum -logscale-"),string("Z p_{T} [GeV]"), 80, 0., 240.);
00073   m_Z_pt=baseAnalysis::initHist(string("Z_pt_high"),string("Z Transverse Momentum"),string("Z p_{T} [GeV]"), 50, 0., 25.);
00074   m_Z_pt_log=baseAnalysis::initHist(string("Z_pt_high_logscale"),string("Z Transverse Momentum -logscale-"),string("Z p_{T} [GeV]"), 50, 0., 25.);
00075   
00076   //change the range to (-8,8)
00077   m_Z_eta=baseAnalysis::initHist(string("Z_eta"),string("#eta Z-Boson"),string("#eta"), 80, -8., 8.);
00078   m_Z_phi=baseAnalysis::initHist(string("Z_phi"),string("#varphi Z-Boson"),string("#varphi"), 64, -3.2, 3.2);
00079 
00080   m_charged_particle_multiplicity=baseAnalysis::initHist(string("charged_particle_multiplicity"),string("Number of charged Particles in the Event"),string("charged particle multiplicity"),100, 0., 300.);
00081 //   m_charged_particle_temp_pt= new TH1D("Z_charged_particle_mean_pt","temp histogramm",200,0,100.);
00082 //   m_charged_particle_pt= new TH1D("Z_charged_particle_pt","p_{T} pf charged particles",200,0,100.);
00083   m_charged_particle_temp_pt=baseAnalysis::initHist(string("Z_charged_particle_temp_mean_pt"),string("temp histogramm"),string("Z charged particle temp mean p_{T}"),200,0,100.);
00084   m_charged_particle_pt=baseAnalysis::initHist(string("Z_charged_particle_pt"),string("p_{T} pf charged particles"),string("p_{T}"),200,0,100.);
00085   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.);
00086   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.);
00087   //  m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),400, -400., 400.);
00088   m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),601, -300., 300.);
00089   
00090   return true;
00091 }
00092 
00093 /**
00094 This is the main analysis function. 
00095 Search the particle, get their properties and the histograms.
00096 */
00097 
00098 int ZAnalysis::Process(HepMC::GenEvent* hepmcevt) 
00099 {
00100 
00101   // Some Variables or storage classes are needed
00102   //int properStatus = 2;
00103 
00104   // Reset the histogramm
00105   m_charged_particle_temp_pt->Reset();
00106   
00107   // Fill the eventnumber
00108   //m_evtnr->Fill((hepmcevt->event_number())%100);
00109   
00110   // initialize the counter variables
00111   int Zcount=0;
00112   int chargeParticlecount=0;
00113 
00114   // loop over the particles and select pdgid and pt
00115   for ( HepMC::GenEvent::particle_const_iterator p =  hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p )
00116     {
00117       HepMC::GenParticle* ZBoson=0;
00118 
00119       // use the pdg id to identify the particles
00120       int pid = (*p)->pdg_id();
00121 
00122 
00123       // Z decays
00124       // look for Z-Bosons (pdg = 23) 
00125       //if( pid == 23 && ((*p)->status())%1000 == properStatus && (*p)->end_vertex()){
00126       if( pid == 23 && (*p)->end_vertex()){
00127 
00128         //search for decaying particles
00129         // since the particles should decay they should have a decay vertex
00130         if (!(*p)->end_vertex()) continue;
00131 
00132         HepMC::GenVertex::particle_iterator firstChild = (*p)->end_vertex()->particles_begin(HepMC::children);
00133         HepMC::GenVertex::particle_iterator endChild =  (*p)->end_vertex()->particles_end(HepMC::children);
00134 
00135         // plot Pt, eta, phi and mass of the Z (generator values)
00136         if( ((*firstChild)->pdg_id()) != pid ){
00137           ZBoson = (*p);
00138 
00139           m_Z_pt->Fill((*p)->momentum().perp());
00140           m_Z_pt_log->Fill((*p)->momentum().perp());
00141           m_Z_pt_high->Fill((*p)->momentum().perp());
00142           m_Z_pt_high_log->Fill((*p)->momentum().perp());
00143           m_Z_eta->Fill((*p)->momentum().eta());
00144           m_Z_phi->Fill((*p)->momentum().phi());
00145           m_Z_mass->Fill((*p)->momentum().m());
00146           m_Z_mass_log->Fill((*p)->momentum().m());
00147           Zcount++;
00148         }
00149       }
00150 
00151       // select final state particles
00152 
00153       // cut out the neutral particles (charge is not stored in HepMC)
00154       // just remove the neutrinos, gammas, neutral pions and
00155       // neutrons, K0s, ... from the final state
00156       if(!chargedParticle(pid)) continue;
00157       //       // these lines are comment out and implemented in the function IsFinalStateParticle in the baseAnalysis:
00158       //       // first of all we need stable particle
00159       //       if (!((*p)->status() == 1)) continue;
00160       //       // They need to have a production Vertex --> we will not select incoming Protons from the Beam 
00161       //       if (!(*p)->production_vertex()) continue;
00162       //       // And since they are stable they should not have a decay vertex. 
00163       //       if ((*p)->end_vertex()) continue;
00164       
00165       //       // fiducial range eta cut on 2.5
00166       //       if(fabs((*p)->momentum().eta()) > 2.5) continue;
00167       //       // minimum pt for tracks on 0.5
00168       //       if((*p)->momentum().perp() < 0.5) continue;
00169       
00170       // take all stable particles
00171       if(!IsFinalStateParticle((*p))) {
00172         continue;
00173       }
00174       // do not count pi0, K0_L, K0_S and K0
00175       //if((abs(pid)==111) || (abs(pid)==130) || (abs(pid)==310) || (abs(pid)==311)) continue;
00176       
00177       //fill values for charged stable particles
00178       m_charged_particle_pt->Fill((*p)->momentum().perp());
00179       m_charged_particle_temp_pt->Fill((*p)->momentum().perp());
00180       chargeParticlecount++;
00181       m_charged_particle_pdgID->Fill(pid);
00182     }
00183 
00184   // storage of input particles for jet
00185   CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00186   
00187   // check if jets were found
00188   //if(!m_inclusive_jets.size()) std::cout<<"ZAnalysis::no jets found"<<std::endl;
00189 
00190   
00191   //Fill the histograms
00192   m_jet_count->Fill(m_inclusive_jets.size()); 
00193 
00194   if(m_inclusive_jets.size()){
00195     m_jet_pt->Fill(m_inclusive_jets[0].perp());
00196     m_jet_pt_log->Fill(m_inclusive_jets[0].perp());
00197   }
00198 
00199   //Fill the histograms
00200   m_Z_count->Fill(Zcount);
00201   m_charged_particle_multiplicity->Fill(chargeParticlecount);
00202   m_charged_particle_mean_pt->Fill(m_charged_particle_temp_pt->GetMean());
00203   m_charged_particle_rms_pt->Fill(m_charged_particle_temp_pt->GetRMS());
00204   
00205   chargeParticlecount=0;
00206   
00207   // not needed, but to be on the safe side
00208   m_charged_particle_temp_pt->Reset();
00209   
00210   return true;
00211 }

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