00001 #include <iostream>
00002 #include <sstream>
00003 #include <stdio.h>
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 #include "CLHEP/Vector/LorentzVector.h"
00012
00013
00014
00015 #include "TH1.h"
00016 #include "TH2.h"
00017 #include "TFile.h"
00018 #include "TMath.h"
00019 #include "TLorentzVector.h"
00020
00021
00022 #include "../include/ZtautauAnalysis.h"
00023
00024 using namespace std;
00025
00026
00027 ZtautauAnalysis::ZtautauAnalysis()
00028 {}
00029
00030
00031 ZtautauAnalysis::~ZtautauAnalysis()
00032 {}
00033
00034
00035 int ZtautauAnalysis::Init(double tr_max_eta, double tr_min_pt)
00036 {
00037
00038 m_max_eta=tr_max_eta;
00039
00040
00041 m_min_pt=tr_min_pt;
00042
00043
00044 m_outputFileName="ZtautauAnalysis.root";
00045 m_outputRootDir="Ztautau";
00046
00047
00048 m_evtnr=initHist(string("evtnr"),string("Event number"),string("Eventnumber"),1000, 0., 1000.);
00049 m_taupt=initHist(string("taupt"),string("transversal momentum of tau+ and tau-"),string("p_{T} [GeV]"),100, 0., 200.);
00050 m_taupt_log=initHist(string("taupt_logscale"),string("transversal momentum of tau+ and tau- - logscale -"),
00051 string("p_{T} [GeV]"),100, 0., 200.);
00052 m_taueta=initHist(string("taueta"),string("eta of tau+ and tau-"),string("#eta"),60, -6., 6.);
00053 m_tauphi=initHist(string("tauphi"),string("phi of tau+ and tau-"),string("#phi"),48, -3.15, 3.15);
00054 m_ptstable=initHist(string("ptstable"),string("transveral momentum of stable particles (without neutrinos)"),
00055 string("p_{T} [GeV]"),60, 0., 15.);
00056 m_ptstable_log=initHist(string("ptstable_logscale"),string("transveral momentum of stable particles (without neutrinos) - logscale"),
00057 string("p_{T} [GeV]"),60, 0., 15.);
00058 m_etastable=initHist(string("etastable"),string("eta of stable particles (without neutrinos)"),string("#eta"),100, -6., 6.);
00059 m_phistable=initHist(string("phistable"),string("phi of stable particles (without neutrinos)"),string("#phi"),100, -3.15, 3.15);
00060 m_E_stable=initHist(string("E_stable"),string("energy of stable particles (without neutrinos)"),string("E [GeV]"),50, 0., 100.);
00061 m_E_stable_log=initHist(string("E_stable_logscale"),string("energy of stable particles (without neutrinos) - logscale -"),
00062 string("E [GeV]"),50, 0., 100.);
00063 m_ptstable_charged=initHist(string("ptstable_charged"),string("transveral momentum of charged stable particles"),
00064 string("p_{T} [GeV]"),200, 0., 50.);
00065 m_ptstable_charged_log=initHist(string("ptstable_charged_logscale"),
00066 string("transveral momentum of charged stable particles - logscale -"),
00067 string("p_{T} [GeV]"),200, 0., 50.);
00068 m_etastable_charged=initHist(string("etastable_charged"),string("eta of charged stable particles"),string("#eta"),100, -6., 6.);
00069 m_phistable_charged=initHist(string("phistable_charged"),string("phi of charged stable particles"),string("#phi"),100, -3.15, 3.15);
00070 m_E_stable_charged=initHist(string("E_stable_without_neutrinos"),string("energy of charged stable particles"),
00071 string("E [GeV]"),100, 0., 200.);
00072 m_E_stable_charged_log=initHist(string("E_stable_without_neutrinos_logscale"),
00073 string("energy of charged stable particles - logscale -"),string("E [GeV]"),100, 0., 200.);
00074 m_cmultpart=initHist(string("cmultpart"),string("number of charged particles in the event"),string("charged particle multiplicity"),
00075 120, 0., 600.);
00076 m_nTrack_tau=initHist(string("nTrack_tau"),string("number of tracks of tau decay"),string("number of tracks"),16, -0.5, 15.5);
00077 m_pt_hightrack=initHist(string("pt_hightrack"),string("transversal momentum of highest p_{T}-track"),string("p_{T} [GeV]"),
00078 200, 0., 100.);
00079 m_pt_hightrack_log=initHist(string("pt_hightrack_logscale"),string("transversal momentum of highest p_{T}-track - logscale -"),
00080 string("p_{T} [GeV]"),200, 0., 100.);
00081
00082 m_jet_count=baseAnalysis::initHist(string("jet_count"), string("Nr of Jets"), string("Nr Jets"),16, -0.5, 15.5);
00083 m_jet_pt=baseAnalysis::initHist(string("leadingjet_pt_high"),string("Leading Jet Transverse Momentum"),string("Jet p_{T} [GeV]"), 200, 0.,1000.);
00084 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.);
00085
00086 return true;
00087 }
00088
00089
00090 int ZtautauAnalysis::Process(HepMC::GenEvent* hepmcevt)
00091 {
00092 int cmult = 0;
00093 int tau_barcode = 0;
00094 int taubar_barcode = 0;
00095
00096
00097 int properStatus = 0;
00098
00099 m_evtnr->Fill(hepmcevt->event_number());
00100
00101
00102 for ( HepMC::GenEvent::particle_const_iterator p =
00103 hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p )
00104 {
00105
00106 int pid = (*p)->pdg_id();
00107
00108
00109 if (pid == 23 && (*p)->end_vertex())
00110 {
00111
00112
00113 if(!((*p)->end_vertex())) continue;
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 for(HepMC::GenVertex::particle_iterator iChild=(*p)->end_vertex()->particles_begin(HepMC::descendants);
00129 iChild!=(*p)->end_vertex()->particles_end(HepMC::descendants); iChild++)
00130 {
00131 if( (*iChild)->pdg_id() != pid )
00132 {
00133 if ((*iChild)->pdg_id() == 15) tau_barcode = (*iChild)->barcode();
00134 if ((*iChild)->pdg_id() == -15) taubar_barcode = (*iChild)->barcode();
00135 }
00136 }
00137 }
00138
00139
00140 if(!IsFinalStateParticle((*p))) continue;
00141
00142 if(! ( abs(pid)==12 || abs(pid)==14 || abs(pid)==16 ) )
00143 {
00144 m_ptstable->Fill( (*p)->momentum().perp() );
00145 m_ptstable_log->Fill( (*p)->momentum().perp() );
00146 m_etastable->Fill( (*p)->momentum().eta() );
00147 m_phistable->Fill( (*p)->momentum().phi() );
00148 m_E_stable->Fill( (*p)->momentum().e() );
00149 m_E_stable_log->Fill( (*p)->momentum().e() );
00150 }
00151
00152
00153
00154
00155 if(!chargedParticle(pid)) continue;
00156
00157 m_ptstable_charged->Fill( (*p)->momentum().perp() );
00158 m_ptstable_charged_log->Fill( (*p)->momentum().perp() );
00159 m_etastable_charged->Fill( (*p)->momentum().eta() );
00160 m_phistable_charged->Fill( (*p)->momentum().phi() );
00161 m_E_stable_charged->Fill( (*p)->momentum().e() );
00162 m_E_stable_charged_log->Fill( (*p)->momentum().e() );
00163
00164 cmult++;
00165 }
00166
00167
00168 CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00169
00170
00171
00172
00173
00174 m_jet_count->Fill(m_inclusive_jets.size());
00175
00176 if(m_inclusive_jets.size()){
00177 m_jet_pt->Fill(m_inclusive_jets[0].perp());
00178 m_jet_pt_log->Fill(m_inclusive_jets[0].perp());
00179 }
00180
00181
00182 HepMC::GenParticle *tau = hepmcevt->barcode_to_particle(tau_barcode);
00183 HepMC::GenParticle *taubar = hepmcevt->barcode_to_particle(taubar_barcode);
00184 if(tau && taubar)
00185 {
00186 m_taupt->Fill( tau->momentum().perp() );
00187 m_taupt->Fill( taubar->momentum().perp() );
00188 m_taupt_log->Fill( tau->momentum().perp() );
00189 m_taupt_log->Fill( taubar->momentum().perp() );
00190 m_taueta->Fill( tau->momentum().eta() );
00191 m_taueta->Fill( taubar->momentum().eta() );
00192 m_tauphi->Fill( tau->momentum().phi() );
00193 m_tauphi->Fill( taubar->momentum().phi() );
00194
00195 m_cmultpart->Fill(cmult);
00196 }
00197
00198
00199
00200
00201
00202
00203
00204 if (tau && tau->end_vertex())
00205 {
00206
00207
00208 if (!tau->end_vertex()) return false;
00209
00210 int nTrack = 0;
00211 double highpT_Track = 0.;
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 for(HepMC::GenVertex::particle_iterator iChild=tau->end_vertex()->particles_begin(HepMC::descendants);
00224 iChild!=tau->end_vertex()->particles_end(HepMC::descendants); iChild++)
00225 {
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 if( (*iChild)->pdg_id() != tau->pdg_id() )
00239 {
00240 int iChild_pid = (*iChild)->pdg_id();
00241 properStatus = 1;
00242
00243 if( chargedParticle(iChild_pid)==true && (*iChild)->status()%1000 == properStatus && !(*iChild)->end_vertex())
00244
00245 {
00246
00247
00248 if ((*iChild)->end_vertex()) continue;
00249
00250 nTrack = nTrack + 1;
00251 if ( (*iChild)->momentum().perp() > highpT_Track )
00252 {
00253 highpT_Track = (*iChild)->momentum().perp();
00254 }
00255 }
00256 }
00257 }
00258
00259
00260
00261
00262
00263
00264 m_nTrack_tau->Fill(nTrack);
00265 m_pt_hightrack->Fill(highpT_Track);
00266 m_pt_hightrack_log->Fill(highpT_Track);
00267
00268 }
00269
00270
00271
00272
00273
00274 if (taubar && taubar->end_vertex())
00275 {
00276
00277
00278 if (!taubar->end_vertex()) return false;
00279
00280 int nTrack = 0;
00281 double highpT_Track = 0.;
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305 for(HepMC::GenVertex::particle_iterator iChild=taubar->end_vertex()->particles_begin(HepMC::descendants);
00306 iChild!=taubar->end_vertex()->particles_end(HepMC::descendants); iChild++)
00307 {
00308 if( (*iChild)->pdg_id() != taubar->pdg_id() )
00309 {
00310 int iChild_pid = (*iChild)->pdg_id();
00311 properStatus = 1;
00312
00313 if( (*iChild)->status()%1000 == properStatus && !(*iChild)->end_vertex() && chargedParticle(iChild_pid)==true)
00314
00315 {
00316
00317
00318 if ((*iChild)->end_vertex()) continue;
00319
00320 nTrack = nTrack + 1;
00321 if ( (*iChild)->momentum().perp() > highpT_Track )
00322 {
00323 highpT_Track = (*iChild)->momentum().perp();
00324 }
00325 }
00326 }
00327
00328 }
00329
00330 if (nTrack > 0)
00331 {
00332 m_nTrack_tau->Fill(nTrack);
00333 m_pt_hightrack->Fill(highpT_Track);
00334 m_pt_hightrack_log->Fill(highpT_Track);
00335 }
00336 }
00337 return true;
00338 }