00001
00002
00003 #include <iostream>
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
00012 #include "HepPDT/ParticleData.hh"
00013 #include "CLHEP/Vector/LorentzVector.h"
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 #include "../include/ZAnalysis.h"
00027
00028 using namespace std;
00029
00030
00031 ZAnalysis::ZAnalysis() : baseAnalysis()
00032 {}
00033
00034
00035 ZAnalysis::~ZAnalysis()
00036 {}
00037
00038
00039
00040
00041 int ZAnalysis::Init( double tr_max_eta, double tr_min_pt )
00042 {
00043 m_max_eta = tr_max_eta;
00044 m_min_pt = tr_min_pt;
00045
00046
00047 m_outputFileName = "ZBosonAnalysis.root";
00048 m_outputRootDir = "Z";
00049
00050
00051 m_jet_count = initHist( "jet_count", "Nr of Jets", "Nr Jets", 16, -0.5, 15.5 );
00052 m_jet_pt = initHist( "leadingjet_pt_high", "Leading Jet Transverse Momentum", "Jet p_{T} [GeV]", 200, 0.0, 1000.0 );
00053 m_jet_pt_log = initHist( "leadingjet_pt_high_logscale", "Leading Jet Transverse Momentum -logscale-",
00054 "Jet p_{T} [GeV]", 200, 0.0, 1000.0 );
00055
00056
00057 m_Z_pt = initHist( "Z_pt", "Z Transverse Momentum", "Z p_{T} [GeV]", 50, 0.0, 25.0 );
00058 m_Z_pt_log = initHist( "Z_pt_logscale", "Z Transverse Momentum -logscale-", "Z p_{T} [GeV]", 50, 0.0, 25.0 );
00059 m_Z_pt_prop = initHist( "Z_pt_prop", "Z Transverse Momentum (propagator)", "Z p_{T} [GeV]", 50, 0.0, 25.0 );
00060 m_Z_pt_prop_log = initHist( "Z_pt_prop_logscale", "Z Transverse Momentum (propagator) -logscale-", "Z p_{T} [GeV]", 50, 0.0, 25.0 );
00061
00062 m_Z_pt_high = initHist( "Z_pt_high", "Z Transverse Momentum", "Z p_{T} [GeV]", 80, 0.0, 240.0 );
00063 m_Z_pt_high_log = initHist( "Z_pt_high_logscale", "Z Transverse Momentum -logscale-",
00064 "Z p_{T} [GeV]", 80, 0.0, 240.0 );
00065 m_Z_pt_high_prop = initHist( "Z_pt_high_prop", "Z Transverse Momentum (propagator)", "Z p_{T} [GeV]", 80, 0.0, 240.0 );
00066 m_Z_pt_high_prop_log = initHist( "Z_pt_high_prop_logscale", "Z Transverse Momentum (propagator) -logscale-",
00067 "Z p_{T} [GeV]", 80, 0.0, 240.0 );
00068
00069
00070 m_Z_eta = initHist( "Z_eta", "#eta Z-Boson", "#eta", 80, -8.0, 8.0 );
00071 m_Z_phi = initHist( "Z_phi", "#varphi Z-Boson", "#varphi", 64, -3.2, 3.2 );
00072 m_Z_eta_prop = initHist( "Z_eta_prop", "#eta Z-Boson (propagator)", "#eta", 80, -8.0, 8.0 );
00073 m_Z_phi_prop = initHist( "Z_phi_prop", "#varphi Z-Boson (propagator)", "#varphi", 64, -3.2, 3.2 );
00074
00075
00076 m_Z_mass = initHist( "Z_mass", "Z Mass", "m_{Z} [GeV]", 80, 70.0, 110.0 );
00077 m_Z_mass_log = initHist( "Z_mass_logscale", "Z Mass -logscale-", "m_{Z} [GeV]", 80, 70.0, 110.0 );
00078 m_Z_mass_prop = initHist( "Z_mass_prop", "Z Mass (propagator)", "m_{Z} [GeV]", 80, 70.0, 110.0 );
00079 m_Z_mass_prop_log = initHist( "Z_mass_prop_logscale", "Z Mass (propagator) -logscale-", "m_{Z} [GeV]", 80, 70.0, 110.0 );
00080
00081 m_charged_particle_multiplicity = initHist( "charged_particle_multiplicity",
00082 "Number of charged Particles in the Event", "charged particle multiplicity", 100, 0.0, 300.0 );
00083 m_charged_particle_temp_pt = initHist( "Z_charged_particle_temp_mean_pt", "temp histogramm",
00084 "Z charged particle temp mean p_{T}", 200, 0.0, 100.0 );
00085 m_charged_particle_pt = initHist( "Z_charged_particle_pt", "p_{T} pf charged particles",
00086 "p_{T}", 200, 0.0, 100.0 );
00087
00088 m_charged_particle_mean_pt = initHist( "charged_particle_mean_pt", "Average p_{T} charged Particles in the Event",
00089 "charged particle #bar{p}_{T}", 50, 0.0, 10.0 );
00090 m_charged_particle_rms_pt = initHist( "charged_particle_rms_pt", "RMS p_{T} charged Particles in the Event",
00091 "charged particle #sigma(p_{T})", 50, 0.0, 10.0 );
00092 m_charged_particle_pdgID = initHist( "charged_particle_pdgID", "charged Particles PDG ID",
00093 "charged particle pid", 601, -300.0, 300.0 );
00094
00095 return true;
00096 }
00097
00098
00099
00100
00101
00102 bool ZAnalysis::FSVector( HepMC::GenEvent::particle_const_iterator &zBoson, ZAnalysis::EParticleType productPid,
00103 HepMC::FourVector &fsVector )
00104 {
00105 size_t nNegParts = 0,
00106 nPosParts = 0;
00107
00108 HepMC::GenVertex::particle_iterator posParticle;
00109 HepMC::GenVertex::particle_iterator negParticle;
00110
00111
00112 for ( HepMC::GenVertex::particle_iterator child = (*zBoson)->end_vertex()->particles_begin( HepMC::children );
00113 child != (*zBoson)->end_vertex()->particles_end( HepMC::children ); ++child ) {
00114
00115
00116 int pid = (*child)->pdg_id();
00117 if ( pid == productPid ) {
00118 posParticle = child;
00119 ++nPosParts;
00120 }
00121 if ( pid == -productPid ) {
00122 negParticle = child;
00123 ++nNegParts;
00124 }
00125 }
00126
00127
00128 if ( nPosParts == 1 && nNegParts == 1 ) {
00129
00130
00131
00132 for ( HepMC::GenVertex::particle_iterator des = (*posParticle)->end_vertex()->particles_begin( HepMC::descendants );
00133 des != (*posParticle)->end_vertex()->particles_end( HepMC::descendants ); ++des ) {
00134 const HepMC::FourVector &desMom = (*des)->momentum();
00135
00136 if ( IsFinalStateParticle( *des) ) {
00137 fsVector.setPx( fsVector.px() + desMom.px() );
00138 fsVector.setPy( fsVector.py() + desMom.py() );
00139 fsVector.setPz( fsVector.pz() + desMom.pz() );
00140 fsVector.setE( fsVector.e() + desMom.e() );
00141 }
00142 }
00143
00144
00145 for ( HepMC::GenVertex::particle_iterator des = (*negParticle)->end_vertex()->particles_begin( HepMC::descendants );
00146 des != (*negParticle)->end_vertex()->particles_end( HepMC::descendants ); ++des ) {
00147 const HepMC::FourVector &desMom = (*des)->momentum();
00148
00149 if ( IsFinalStateParticle( *des) ) {
00150 fsVector.setPx( fsVector.px() + desMom.px() );
00151 fsVector.setPy( fsVector.py() + desMom.py() );
00152 fsVector.setPz( fsVector.pz() + desMom.pz() );
00153 fsVector.setE( fsVector.e() + desMom.e() );
00154 }
00155 }
00156
00157 if ( fsVector.m() == 0 ) {
00158 return false;
00159 }
00160
00161 return true;
00162 }
00163
00164 return false;
00165 }
00166
00167
00168
00169
00170
00171 int ZAnalysis::Process( HepMC::GenEvent* hepmcevt )
00172 {
00173
00174 m_charged_particle_temp_pt->Reset();
00175
00176 size_t cntZ = 0;
00177 size_t cntChargedParts = 0;
00178
00179
00180 for ( HepMC::GenEvent::particle_const_iterator p = hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p ) {
00181 int pid = (*p)->pdg_id();
00182
00183
00184 HepMC::FourVector eeFs( 0.0, 0.0, 0.0, 0.0 );
00185 HepMC::FourVector mumuFs( 0.0, 0.0, 0.0, 0.0 );
00186
00187 if ( pid == 23 && (*p)->end_vertex() ) {
00188
00189 HepMC::GenVertex::particle_iterator firstChild = (*p)->end_vertex()->particles_begin(HepMC::children);
00190 HepMC::GenVertex::particle_iterator endChild = (*p)->end_vertex()->particles_end(HepMC::children);
00191
00192
00193 if( (*firstChild)->pdg_id() != pid ){
00194 const HepMC::FourVector &mom = (*p)->momentum();
00195
00196 m_Z_pt_prop->Fill( mom.perp() );
00197 m_Z_pt_prop_log->Fill( mom.perp() );
00198 m_Z_pt_high_prop->Fill( mom.perp() );
00199 m_Z_pt_high_prop_log->Fill( mom.perp() );
00200 m_Z_eta_prop->Fill( mom.eta() );
00201 m_Z_phi_prop->Fill( mom.phi() );
00202 m_Z_mass_prop->Fill( mom.m() );
00203 m_Z_mass_prop_log->Fill( mom.m() );
00204 }
00205
00206 if ( FSVector( p, ZAnalysis::Electron, eeFs ) ) {
00207 FillZHistograms( eeFs );
00208 }
00209 if ( FSVector( p, ZAnalysis::Muon, mumuFs ) ) {
00210 FillZHistograms( mumuFs );
00211 }
00212 ++cntZ;
00213 }
00214
00215 if( !IsFinalStateParticle( *p ) ) {
00216 continue;
00217 }
00218
00219
00220
00221
00222 if( !chargedParticle( pid ) ) {
00223 continue;
00224 }
00225 ++cntChargedParts;
00226
00227
00228 m_charged_particle_pt->Fill( (*p)->momentum().perp() );
00229 m_charged_particle_temp_pt->Fill( (*p)->momentum().perp() );
00230 m_charged_particle_pdgID->Fill( pid );
00231 }
00232
00233
00234 m_charged_particle_multiplicity->Fill( cntChargedParts );
00235
00236 m_charged_particle_mean_pt->Fill( m_charged_particle_temp_pt->GetMean() );
00237 m_charged_particle_rms_pt->Fill( m_charged_particle_temp_pt->GetRMS() );
00238
00239 m_jet_count->Fill( m_inclusive_jets.size() );
00240
00241 if ( !m_inclusive_jets.empty() ){
00242 m_jet_pt->Fill( m_inclusive_jets[0].perp() );
00243 m_jet_pt_log->Fill( m_inclusive_jets[0].perp() );
00244 }
00245
00246 return true;
00247 }
00248
00249
00250
00251
00252 void ZAnalysis::FillZHistograms( const HepMC::FourVector &fsVec )
00253 {
00254 const double &pt = fsVec.perp();
00255
00256
00257
00258 m_Z_pt->Fill( pt );
00259 m_Z_pt_log->Fill( pt );
00260 m_Z_pt_high->Fill( pt );
00261 m_Z_pt_high_log->Fill( pt );
00262
00263 m_Z_phi->Fill( fsVec.phi() );
00264 m_Z_eta->Fill( fsVec.eta());
00265 m_Z_mass->Fill( fsVec.m() );
00266 m_Z_mass_log->Fill( fsVec.m() );
00267 }
00268