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 #define PI 3.141593
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/UEAnalysis.h"
00028
00029
00030
00031
00032 UEAnalysis::UEAnalysis() {
00033
00034 }
00035
00036
00037 UEAnalysis::~UEAnalysis() {
00038
00039 }
00040
00041 int UEAnalysis::Init(double tr_max_eta, double tr_min_pt) {
00042
00043 m_max_eta=tr_max_eta;
00044
00045
00046 m_min_pt=tr_min_pt;
00047
00048
00049 m_outputFileName="UEAnalysis.root";
00050 m_outputRootDir="UE";
00051
00052 char name1[20],title1[20];
00053 char name2[20],title2[20];
00054 char name3[20],title3[20];
00055
00056 for (int i=0; i<26; i++){
00057
00058
00059 sprintf(name1,"NchargedToward_%2d",i);
00060 sprintf(name2,"NchargedTransverse_%2d",i);
00061 sprintf(name3,"NchargedAway_%2d",i);
00062
00063 sprintf(title1,"NchargedToward_%2d",i);
00064 sprintf(title2,"NchargedTransverse_%2d",i);
00065 sprintf(title2,"NchargedAway_%2d",i);
00066
00067 m_NchargedToward[i] = new TH1D(name1,title1, 20, 0, 100);
00068 m_NchargedTransverse[i] = new TH1D(name2,title2, 20, 0, 100);
00069 m_NchargedAway[i] = new TH1D(name3,title3, 20, 0, 100);
00070
00071
00072
00073
00074
00075 sprintf(name1,"PtsumToward_%2d",i);
00076 sprintf(name2,"PtsumTransverse_%2d",i);
00077 sprintf(name3,"PtsumAway_%2d",i);
00078
00079 sprintf(title1,"PtsumToward_%2d",i);
00080 sprintf(title2,"PtsumTransverse_%2d",i);
00081 sprintf(title2,"PtsumAway_%2d",i);
00082
00083 m_PtsumToward[i] = new TH1D(name1,title1, 20, 0, 100);
00084 m_PtsumTransverse[i] = new TH1D(name2,title2, 20, 0, 100);
00085 m_PtsumAway[i] = new TH1D(name3,title3, 20, 0, 100);
00086
00087
00088
00089
00090 }
00091
00092
00093
00094 m_nbin_pT = 25;
00095
00096 for (int i=0; i<11; i++) {
00097 m_nbinRange_pT[i] = i;
00098 }
00099 for (int i=11; i<21; i++) {
00100 m_nbinRange_pT[i] = 10.0+ 3.0*(i-10);
00101 }
00102 m_nbinRange_pT[21] = 50.;
00103 m_nbinRange_pT[22] = 60.;
00104 m_nbinRange_pT[23] = 70.;
00105 m_nbinRange_pT[24] = 80.;
00106 m_nbinRange_pT[25] = 120.;
00107
00108
00109 m_NchargedMeanToward = baseAnalysis::initHistVariableBin( string("NchargedMeanToward"), string("NchargedMeanToward"), string("Pt_leadingJet"), m_nbin_pT, m_nbinRange_pT);
00110 m_NchargedMeanTransverse = baseAnalysis::initHistVariableBin( string("NchargedMeanTransverse"), string("NchargedMeanTransverse"), string("Pt_leadingJet"), m_nbin_pT, m_nbinRange_pT);
00111 m_NchargedMeanAway = baseAnalysis::initHistVariableBin( string("NchargedMeanAway"), string("NchargedMeanAway"), string("Pt_leadingJet"),m_nbin_pT, m_nbinRange_pT);
00112
00113 m_PtsumMeanToward = baseAnalysis::initHistVariableBin( string("PtsumMeanToward"), string("PtsumMeanToward"), string("Pt_leadingJet"), m_nbin_pT, m_nbinRange_pT);
00114 m_PtsumMeanTransverse = baseAnalysis::initHistVariableBin( string("PtsumMeanTransverse"), string("PtsumMeanTransverse"), string("Pt_leadingJet"), m_nbin_pT, m_nbinRange_pT);
00115 m_PtsumMeanAway = baseAnalysis::initHistVariableBin( string("PtsumMeanAway"), string("PtsumMeanAway"), string("Pt_leadingJet"),m_nbin_pT, m_nbinRange_pT);
00116
00117 m_Njet = baseAnalysis::initHist( string("Njet"), string("Njet"), string("jet Number"), 16, -0.5, 15.5);
00118 m_Ptjet = baseAnalysis::initHist( string("Ptjet"), string("jet p_{T}"), string("jet p_{T}"), 50, 0, 200);
00119 m_Ptjet_log = baseAnalysis::initHist( string("Ptjet_logscale"), string("jet p_{T}"), string("jet p_{T} - logscale -"), 50, 0, 200);
00120 m_Ptleadingjet = baseAnalysis::initHist( string("Ptleadingjet"), string("leading jet p_{T}"), string("leading jet p_{T}"), 50, 0, 200);
00121 m_Ptleadingjet_log = baseAnalysis::initHist( string("Ptleadingjet_logscale"), string("leading jet p_{T}"),
00122 string("leading jet p_{T} - logscale -"), 50, 0, 200);
00123
00124 m_charged_particle_pt=baseAnalysis::initHist("charged_particle_pt","p_{T} of charged particles","p_{T}",25,0,25.);
00125
00126 return true;
00127 }
00128
00129
00130 int UEAnalysis::Process(HepMC::GenEvent* hepmcevt){
00131
00132
00133 double leadingJetPt = 0.0;
00134 CLHEP::HepLorentzVector lv_leadingJet(0,0,0,0);
00135
00136
00137
00138
00139
00140
00141 if(m_inclusive_jets.size()) {
00142
00143 lv_leadingJet.setPx(m_inclusive_jets[0].px());
00144 lv_leadingJet.setPy(m_inclusive_jets[0].py());
00145 lv_leadingJet.setPz(m_inclusive_jets[0].pz());
00146 lv_leadingJet.setE(m_inclusive_jets[0].e());
00147
00148 leadingJetPt = m_inclusive_jets[0].perp();
00149
00150 for(unsigned int i=0; i<m_inclusive_jets.size(); i++) {
00151 m_Ptjet->Fill(m_inclusive_jets[i].perp());
00152 m_Ptjet_log->Fill(m_inclusive_jets[i].perp());
00153 }
00154 m_Njet->Fill(m_inclusive_jets.size());
00155 m_Ptleadingjet->Fill(m_inclusive_jets[0].perp());
00156 m_Ptleadingjet_log->Fill(m_inclusive_jets[0].perp());
00157 }
00158 int NchargedToward[25];
00159 int NchargedTransverse[25];
00160 int NchargedAway[25];
00161
00162 double PtsumToward[25];
00163 double PtsumTransverse[25];
00164 double PtsumAway[25];
00165
00166 for(int i=0; i<m_nbin_pT; i++){
00167 NchargedToward[i]=0;
00168 NchargedTransverse[i]=0;
00169 NchargedAway[i]=0;
00170
00171 PtsumToward[i]=0;
00172 PtsumTransverse[i]=0;
00173 PtsumAway[i]=0;
00174 }
00175
00176
00177 int ileadjet = -1;
00178
00179 for(int i=0; i<m_nbin_pT; i++) {
00180 if( leadingJetPt > m_nbinRange_pT[i] && leadingJetPt < m_nbinRange_pT[i+1])
00181 ileadjet = i;
00182 }
00183
00184
00185 for ( HepMC::GenEvent::particle_const_iterator p =
00186 hepmcevt->particles_begin(); p != hepmcevt->particles_end(); ++p ){
00187
00188
00189 int pid = (*p)->pdg_id();
00190
00191
00192
00193
00194 if(!chargedParticle(pid)) continue;
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 if(!IsFinalStateParticle((*p))) continue;
00206
00207 m_charged_particle_pt->Fill((*p)->momentum().perp());
00208
00209
00210 if(ileadjet == -1) continue;
00211
00212 double pt = (*p)->momentum().perp();
00213 double px = (*p)->momentum().px();
00214 double py = (*p)->momentum().py();
00215 double pz = (*p)->momentum().pz();
00216 double pe = (*p)->momentum().e();
00217
00218 CLHEP::HepLorentzVector lv_chargedParticle(px,py,pz,pe);
00219
00220
00221 if( fabs(lv_chargedParticle.vect().deltaPhi(lv_leadingJet.vect())) < PI/3.0 ) {
00222 NchargedToward[ileadjet]++;
00223 PtsumToward[ileadjet]+=pt;
00224 }
00225
00226
00227 if( fabs(lv_chargedParticle.vect().deltaPhi(lv_leadingJet.vect())) >= PI/3.0 &&
00228 fabs(lv_chargedParticle.vect().deltaPhi(lv_leadingJet.vect())) < 2.0*PI/3.0 ) {
00229 NchargedTransverse[ileadjet]++;
00230 PtsumTransverse[ileadjet]+=pt;
00231 }
00232
00233 if( fabs(lv_chargedParticle.vect().deltaPhi(lv_leadingJet.vect())) >= 2.0*PI/3.0 ) {
00234 NchargedAway[ileadjet]++;
00235 PtsumAway[ileadjet]+=pt;
00236 }
00237
00238 m_NchargedToward[ileadjet]->Fill(NchargedToward[ileadjet], 1.);
00239 m_NchargedTransverse[ileadjet]->Fill(NchargedTransverse[ileadjet], 1.);
00240 m_NchargedAway[ileadjet]->Fill(NchargedAway[ileadjet], 1.);
00241
00242 m_PtsumToward[ileadjet]->Fill(PtsumToward[ileadjet], 1.);
00243 m_PtsumTransverse[ileadjet]->Fill(PtsumTransverse[ileadjet], 1.);
00244 m_PtsumAway[ileadjet]->Fill(PtsumAway[ileadjet], 1.);
00245
00246 }
00247
00248 return true;
00249 }
00250
00251 std::vector<TH1D*> UEAnalysis::averagedHistograms() {
00252
00253
00254 for(int i=0; i<m_nbin_pT; i++){
00255 m_NchargedMeanToward->SetBinContent( i+1, m_NchargedToward[i]->GetMean() );
00256 m_NchargedMeanToward->SetBinError( i+1, m_NchargedToward[i]->GetRMS() );
00257
00258 m_NchargedMeanTransverse->SetBinContent( i+1, m_NchargedTransverse[i]->GetMean() );
00259 m_NchargedMeanTransverse->SetBinError( i+1, m_NchargedTransverse[i]->GetRMS() );
00260
00261 m_NchargedMeanAway->SetBinContent( i+1, m_NchargedAway[i]->GetMean() );
00262 m_NchargedMeanAway->SetBinError( i+1, m_NchargedAway[i]->GetRMS() );
00263
00264 m_PtsumMeanToward->SetBinContent( i+1, m_PtsumToward[i]->GetMean() );
00265 m_PtsumMeanToward->SetBinError( i+1, m_PtsumToward[i]->GetRMS() );
00266
00267 m_PtsumMeanTransverse->SetBinContent( i+1, m_PtsumTransverse[i]->GetMean() );
00268 m_PtsumMeanTransverse->SetBinError( i+1, m_PtsumTransverse[i]->GetRMS() );
00269
00270 m_PtsumMeanAway->SetBinContent( i+1, m_PtsumAway[i]->GetMean() );
00271 m_PtsumMeanAway->SetBinError( i+1, m_PtsumAway[i]->GetRMS() );
00272 }
00273
00274
00275
00276 return m_histVector;
00277 }
00278
00279
00280 int UEAnalysis::Finalize()
00281 {
00282 return baseAnalysis::Finalize();
00283 }
00284
00285
00286 int UEAnalysis::Finalize(TFile* output){
00287
00288 averagedHistograms();
00289
00290 baseAnalysis::Finalize(output);
00291
00292 return true;
00293 }
00294