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
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
00027 #include "../include/ZAnalysis.h"
00028
00029
00030
00031
00032
00033
00034 ZAnalysis::ZAnalysis()
00035 {
00036
00037 }
00038
00039
00040
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
00052
00053 int ZAnalysis::Init(double tr_max_eta, double tr_min_pt)
00054 {
00055
00056 m_max_eta=tr_max_eta;
00057
00058
00059 m_min_pt=tr_min_pt;
00060
00061
00062 m_outputFileName="ZBosonAnalysis.root";
00063 m_outputRootDir="Z";
00064
00065
00066
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
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
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
00110
00111
00112
00113 int ZAnalysis::Process(HepMC::GenEvent* hepmcevt)
00114 {
00115
00116
00117
00118
00119
00120 m_charged_particle_temp_pt->Reset();
00121
00122
00123
00124
00125
00126 int Zcount=0;
00127 int chargeParticlecount=0;
00128
00129
00130 for ( HepMC::GenEvent::particle_const_iterator p = hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p )
00131 {
00132 HepMC::GenParticle* ZBoson=0;
00133
00134
00135 int pid = (*p)->pdg_id();
00136
00137
00138
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
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
00160
00161
00162 if(chargedParticle(pid)==NOTCHARGED) continue;
00163
00164
00165
00166 if (!((*p)->status() == 1)) continue;
00167
00168 if (!(*p)->production_vertex()) continue;
00169
00170 if ((*p)->end_vertex()) continue;
00171
00172 if(abs((*p)->momentum().eta()) > m_max_eta) continue;
00173
00174 if((*p)->momentum().perp() < m_min_pt) continue;
00175
00176 if(((abs(pid)==11) || (abs(pid)==13)) && trackfromPID(23,(*p))) continue;
00177
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
00181
00182
00183
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
00191 CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00192
00193
00194 if(!m_inclusive_jets.size()) {
00195 int test = FindJet(hepmcevt);
00196 if(test<=0){
00197 cout <<"no jets found - return failure" << endl;
00198
00199 }
00200 }
00201
00202
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
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
00219 m_charged_particle_temp_pt->Reset();
00220
00221 return SUCCESS;
00222 }