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

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"),100, 0., 100.);
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_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.);
00084   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.);
00085   //  m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),400, -400., 400.);
00086   m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),601, -300., 300.);
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 
00096 int ZAnalysis::Process(HepMC::GenEvent* hepmcevt) 
00097 {
00098 
00099   // Some Variables or storage classes are needed
00100   int properStatus = 2;
00101 
00102   // Reset the histogramm
00103   m_charged_particle_temp_pt->Reset();
00104   
00105   // Fill the eventnumber
00106   //m_evtnr->Fill((hepmcevt->event_number())%100);
00107   
00108   // initialize the counter variables
00109   int Zcount=0;
00110   int chargeParticlecount=0;
00111 
00112   // loop over the particles and select pdgid and pt
00113   for ( HepMC::GenEvent::particle_const_iterator p =  hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p )
00114     {
00115       HepMC::GenParticle* ZBoson=0;
00116 
00117       // use the pdg id to identify the particles
00118       int pid = (*p)->pdg_id();
00119 
00120 
00121       // Z decays
00122       // look for Z-Bosons (pdg = 23) 
00123       if( pid == 23 && ((*p)->status()) == properStatus ){
00124 
00125         HepMC::GenVertex::particle_iterator firstChild = (*p)->end_vertex()->particles_begin(HepMC::children);
00126         HepMC::GenVertex::particle_iterator endChild =  (*p)->end_vertex()->particles_end(HepMC::children);
00127 
00128         // plot Pt, eta, phi and mass of the Z (generator values)
00129         if( ((*firstChild)->pdg_id()) != pid ){
00130           ZBoson = (*p);
00131 
00132           m_Z_pt->Fill((*p)->momentum().perp());
00133           m_Z_pt_log->Fill((*p)->momentum().perp());
00134           m_Z_pt_high->Fill((*p)->momentum().perp());
00135           m_Z_pt_high_log->Fill((*p)->momentum().perp());
00136           m_Z_eta->Fill((*p)->momentum().eta());
00137           m_Z_phi->Fill((*p)->momentum().phi());
00138           m_Z_mass->Fill((*p)->momentum().m());
00139           m_Z_mass_log->Fill((*p)->momentum().m());
00140           Zcount++;
00141         }
00142       }
00143 
00144       // select final state particles
00145 
00146       // cut out the neutral particles (charge is not stored in HepMC)
00147       // just remove the neutrinos, gammas, neutral pions and
00148       // neutrons, K0s, ... from the final state
00149       if(!chargedParticle(pid)) continue;
00150       //       // these lines are comment out and implemented in the function IsFinalStateParticle in the baseAnalysis:
00151       //       // first of all we need stable particle
00152       //       if (!((*p)->status() == 1)) continue;
00153       //       // They need to have a production Vertex --> we will not select incoming Protons from the Beam 
00154       //       if (!(*p)->production_vertex()) continue;
00155       //       // And since they are stable they should not have a decay vertex. 
00156       //       if ((*p)->end_vertex()) continue;
00157       
00158       //       // fiducial range eta cut on 2.5
00159       //       if(fabs((*p)->momentum().eta()) > 2.5) continue;
00160       //       // minimum pt for tracks on 0.5
00161       //       if((*p)->momentum().perp() < 0.5) continue;
00162       
00163       // take all stable particles
00164       if(!IsFinalStateParticle((*p))) {
00165         //cout << "(*p) " << (*p)->Print());
00166         continue;
00167       }
00168       // do not count pi0, K0_L, K0_S and K0
00169       //if((abs(pid)==111) || (abs(pid)==130) || (abs(pid)==310) || (abs(pid)==311)) continue;
00170       
00171       //fill values for charged stable particles
00172       m_charged_particle_pt->Fill((*p)->momentum().perp());
00173       m_charged_particle_temp_pt->Fill((*p)->momentum().perp());
00174       chargeParticlecount++;
00175       m_charged_particle_pdgID->Fill(pid);
00176     }
00177 
00178   // storage of input particles for jet
00179   CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00180   
00181   // check if jets were found
00182   //if(!m_inclusive_jets.size()) std::cout<<"ZAnalysis::no jets found"<<std::endl;
00183 
00184   
00185   //Fill the histograms
00186   m_jet_count->Fill(m_inclusive_jets.size()); 
00187 
00188   if(m_inclusive_jets.size()){
00189     m_jet_pt->Fill(m_inclusive_jets[0].perp());
00190     m_jet_pt_log->Fill(m_inclusive_jets[0].perp());
00191   }
00192 
00193   //Fill the histograms
00194   m_Z_count->Fill(Zcount);
00195   m_charged_particle_multiplicity->Fill(chargeParticlecount);
00196   m_charged_particle_mean_pt->Fill(m_charged_particle_temp_pt->GetMean());
00197   m_charged_particle_rms_pt->Fill(m_charged_particle_temp_pt->GetRMS());
00198   
00199   chargeParticlecount=0;
00200   
00201   // not needed, but to be on the safe side
00202   m_charged_particle_temp_pt->Reset();
00203   
00204   return true;
00205 }

Generated on Thu Jul 23 14:57:36 2009 for HepMCAnalysis by  doxygen 1.3.9.1