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 /**
00040 Destructor: delete all the Pointer
00041 */
00042 ZAnalysis::~ZAnalysis()
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 ZAnalysis::Init(double tr_max_eta, double tr_min_pt)
00054 {
00055   // specify default eta cut
00056   m_max_eta=tr_max_eta;  
00057   
00058   // specify default pt cut
00059   m_min_pt=tr_min_pt;  
00060   
00061   // default Output file name
00062   m_outputFileName="ZBosonAnalysis.root";
00063   m_outputRootDir="Z";
00064   
00065   //declaration of histograms
00066   //m_evtnr=baseAnalysis::initHist(string("evtnr"),string("Event number"),string("Eventnumber"),100, 0., 100.);
00067   
00068   m_jet_count=baseAnalysis::initHist(string("jet_count"), string("Nr of Jets"), string("Nr Jets"),16, -0.5, 15.5);
00069   m_jet_pt=baseAnalysis::initHist(string("jet_pt_high"),string("Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 50, 0.,150.);
00070   m_jet_pt_log=baseAnalysis::initHist(string("jet_pt_high_logscale"),string("Jet Transverse Momentum -logscale-"),string("Jet p_{T} [GeV]"), 50, 0.,150.);
00071   
00072   m_Z_count=baseAnalysis::initHist(string("Z_count"), string("Nr of Z-Bosons"), string("Nr Z-Boson"),16, -0.5, 15.5);
00073   m_Z_mass=baseAnalysis::initHist(string("Z_mass"),string("Z Mass"),string("m_{Z} [GeV]"), 80, 70., 110.);
00074   m_Z_mass_log=baseAnalysis::initHist(string("Z_mass_logscale"),string("Z Mass -logscale-"),string("m_{Z} [GeV]"), 80, 70., 110.);
00075   
00076   m_Z_pt=baseAnalysis::initHist(string("Z_pt_high"),string("Z Transverse Momentum"),string("Z p_{T} [GeV]"), 50, 0., 25.);
00077   m_Z_pt_log=baseAnalysis::initHist(string("Z_pt_high_logscale"),string("Z Transverse Momentum -logscale-"),string("Z p_{T} [GeV]"), 50, 0., 25.);
00078   m_Z_pt_high=baseAnalysis::initHist(string("Z_pt_high"),string("Z Transverse Momentum"),string("Z p_{T} [GeV]"), 50, 0., 150.);
00079   m_Z_pt_high_log=baseAnalysis::initHist(string("Z_pt_high_logscale"),string("Z Transverse Momentum -logscale-"),string("Z p_{T} [GeV]"), 50, 0., 150.);
00080   
00081   //change the range to (-8,8)
00082   m_Z_eta=baseAnalysis::initHist(string("Z_eta"),string("#eta Z-Boson"),string("#eta"), 80, -8., 8.);
00083   m_Z_phi=baseAnalysis::initHist(string("Z_phi"),string("#varphi Z-Boson"),string("#varphi"), 64, -3.2, 3.2);
00084 
00085   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.);
00086   m_charged_particle_temp_pt= new TH1D("Z_charged_particle_mean_pt","temp histogramm",200,0,100.);
00087   m_charged_particle_pt= new TH1D("Z_charged_particle_pt","p_{T} pf charged particles",200,0,100.);
00088   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.);
00089   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.);
00090   //  m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),400, -400., 400.);
00091   m_charged_particle_pdgID=baseAnalysis::initHist(string("charged_particle_pdgID"),string("charged Particles PDG ID"),string("charged particle pid"),100, 200., 300.);
00092   
00093   for(unsigned int hist=0; hist< m_histVector.size(); hist++)
00094     {
00095       std::ostringstream counter_s;
00096       counter_s << hist;
00097       std::string histogram_name=m_outputRootDir;
00098       histogram_name+="_";
00099       histogram_name+=counter_s.str();
00100       histogram_name+="_";
00101       histogram_name+=m_histVector[hist]->GetName();
00102       m_histVector[hist]->SetName(histogram_name.c_str());
00103     }
00104   
00105   return SUCCESS;
00106 }
00107 
00108 /**
00109 This is the main analysis function. 
00110 Search the particle, get their properties and the histograms.
00111 */
00112 
00113 int ZAnalysis::Process(HepMC::GenEvent* hepmcevt) 
00114 {
00115 
00116   // Some Variables or storage classes are needed
00117   //int properStatus = 2;
00118 
00119   // Reset the histogramm
00120   m_charged_particle_temp_pt->Reset();
00121   
00122   // Fill the eventnumber
00123   //m_evtnr->Fill((hepmcevt->event_number())%100);
00124   
00125   // initialize the counter variables
00126   int Zcount=0;
00127   int chargeParticlecount=0;
00128 
00129   // loop over the particles and select pdgid and pt
00130   for ( HepMC::GenEvent::particle_const_iterator p =  hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p )
00131     {
00132       HepMC::GenParticle* ZBoson=0;
00133 
00134       // use the pdg id to identify the particles
00135       int pid = (*p)->pdg_id();
00136       
00137       // Z decays
00138       // look for Z-Bosons (pdg = 23) 
00139       if( pid == 23 && (*p)->end_vertex()){
00140 
00141         HepMC::GenVertex::particle_iterator firstChild = (*p)->end_vertex()->particles_begin(HepMC::children);
00142         HepMC::GenVertex::particle_iterator endChild =  (*p)->end_vertex()->particles_end(HepMC::children);
00143 
00144         // plot Pt, eta, phi and mass of the Z (generator values)
00145         if( ((*firstChild)->pdg_id()) != pid ){
00146           ZBoson = (*p);
00147 
00148           m_Z_pt->Fill((*p)->momentum().perp());
00149           m_Z_pt_log->Fill((*p)->momentum().perp());
00150           m_Z_pt_high->Fill((*p)->momentum().perp());
00151           m_Z_pt_high_log->Fill((*p)->momentum().perp());
00152           m_Z_eta->Fill((*p)->momentum().eta());
00153           m_Z_phi->Fill((*p)->momentum().phi());
00154           m_Z_mass->Fill((*p)->momentum().m());
00155           m_Z_mass_log->Fill((*p)->momentum().m());
00156           Zcount++;
00157         }
00158       }
00159       // cut out the neutral particles (charge is not stored in HepMC)
00160       // just remove the neutrinos, gammas, neutral pions and
00161       // neutrons, K0s, ... from the final state
00162       if(chargedParticle(pid)==NOTCHARGED) continue;
00163 
00164       // now collect the tracks for the Jet algorithm
00165       // first of all we need stable particle
00166       if (!((*p)->status() == 1)) continue;
00167       // They need to have a production Vertex --> we will not select incoming Protons from the Beam 
00168       if (!(*p)->production_vertex()) continue;
00169       // And since they are stable they should not have a decay vertex. 
00170       if ((*p)->end_vertex()) continue;
00171       // fiducial range eta cut
00172       if(abs((*p)->momentum().eta()) > m_max_eta) continue;
00173       // minimum pt for tracks
00174       if((*p)->momentum().perp() < m_min_pt) continue;
00175       // check wether the track directly comes from a Z-Boson
00176       if(((abs(pid)==11) || (abs(pid)==13)) && trackfromPID(23,(*p))) continue;
00177       // check wether the track directly comes from a W-Boson      
00178       if(((abs(pid)==11) || (abs(pid)==13)) && trackfromPID(24,(*p))) continue;
00179       if(((abs(pid)==11) || (abs(pid)==13)) && trackfromPID(-24,(*p))) continue;
00180       // do not count pi0, K0_L, K0_S and K0
00181       //if((abs(pid)==111) || (abs(pid)==130) || (abs(pid)==310) || (abs(pid)==311)) continue;
00182       
00183       //fill values for charged stable particles
00184       m_charged_particle_pt->Fill((*p)->momentum().perp());
00185       m_charged_particle_temp_pt->Fill((*p)->momentum().perp());
00186       chargeParticlecount++;
00187       m_charged_particle_pdgID->Fill(pid);
00188     }
00189 
00190   // storage of input particles for jet
00191   CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00192   
00193   // run the jetfinder
00194   if(!m_inclusive_jets.size()) {
00195     int test = FindJet(hepmcevt);
00196     if(test<=0){
00197       cout <<"no jets found - return failure" << endl;
00198       //return FAILURE;
00199     }
00200   }
00201   
00202   //Fill the histograms
00203   m_jet_count->Fill(m_inclusive_jets.size()); 
00204 
00205   if(m_inclusive_jets.size()){
00206     m_jet_pt->Fill(m_inclusive_jets[0].perp());
00207     m_jet_pt_log->Fill(m_inclusive_jets[0].perp());
00208   }
00209 
00210   //Fill the histograms
00211   m_Z_count->Fill(Zcount);
00212   m_charged_particle_multiplicity->Fill(chargeParticlecount);
00213   m_charged_particle_mean_pt->Fill(m_charged_particle_temp_pt->GetMean());
00214   m_charged_particle_rms_pt->Fill(m_charged_particle_temp_pt->GetRMS());
00215   
00216   chargeParticlecount=0;
00217   
00218   // not needed, but to be on the safe side
00219   m_charged_particle_temp_pt->Reset();
00220   
00221   return SUCCESS;
00222 }

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