11 #include <TLorentzVector.h>
12 #include <g4jets/Jet.h>
13 #include <g4jets/JetMap.h>
24 #include <HepMC/GenEvent.h>
25 #include <HepMC/GenVertex.h>
65 cout <<
"GATHERING IN ETA: [" <<
etalow
66 <<
"," <<
etahigh <<
"]" << endl;
68 cout <<
"USING ISOLATION CONE: " <<
use_isocone << endl;
73 histo =
new TH1F(
"histo",
"histo", 100, -3, 3);
75 tree =
new TTree(
"tree",
"a tree");
86 cout <<
"at event number " <<
nevents << endl;
91 ostringstream truthjetsize;
94 truthjetsize <<
"AntiKt_Truth_r";
100 truthjetsize <<
"02";
104 truthjetsize <<
"03";
108 truthjetsize <<
"04";
112 truthjetsize <<
"05";
116 truthjetsize <<
"06";
121 truthjetsize <<
"07";
127 truthjetsize <<
"04";
132 findNode::getClass<JetMap>(topnode, truthjetsize.str().c_str());
140 cout <<
"no truth jets" << endl;
145 cout <<
"no truth track info" << endl;
157 cout <<
"GETTING HEPMC" << endl;
159 PHHepMCGenEventMap *hepmceventmap = findNode::getClass<PHHepMCGenEventMap>(topnode,
"PHHepMCGenEventMap");
163 cout <<
"hepmc event node is missing, BAILING" << endl;
172 cout <<
PHWHERE <<
"no hepmcevent pointer, bailing" << endl;
176 HepMC::GenEvent *truthevent = hepmcevent->
getEvent();
179 cout <<
PHWHERE <<
"no evt pointer under phhepmvgenevent found " << endl;
184 if (truthevent->valid_beam_particles())
186 HepMC::GenParticle *part1 = truthevent->beam_particles().first;
193 HepMC::PdfInfo *pdfinfo = truthevent->pdf_info();
201 cout <<
"Looping over HEPMC particles" << endl;
205 for (HepMC::GenEvent::particle_const_iterator iter = truthevent->particles_begin(); iter != truthevent->particles_end(); ++iter)
209 trutheta = (*iter)->momentum().pseudoRapidity();
210 truthphi = (*iter)->momentum().phi();
211 truthpx = (*iter)->momentum().px();
212 truthpy = (*iter)->momentum().py();
213 truthpz = (*iter)->momentum().pz();
221 cout <<
"LOOPING OVER G4 TRUTH PARTICLES" << endl;
227 float lastenergy = 0;
262 cout <<
"LOOPING OVER TRUTH JETS" << endl;
269 float hardest_jet = 0;
270 float subleading_jet = 0;
271 int numtruthjets = 0;
279 Jet *jet = iter->second;
302 std::set<PHG4Particle *> truthjetcomp =
303 trutheval->all_truth_particles(jet);
304 int _ntruthconstituents = 0;
306 for (std::set<PHG4Particle *>::iterator iter2 = truthjetcomp.begin();
307 iter2 != truthjetcomp.end();
313 cout <<
"no truth particles in the jet??" << endl;
316 _ntruthconstituents++;
318 TLorentzVector constvec;
319 constvec.SetPxPyPzE(truthpart->
get_px(),
324 int constpid = truthpart->
get_pid();
341 if (_ntruthconstituents < 3)
386 Jet *jet = iter2->second;
387 float subtruthjetpt = jet->
get_pt();
391 float subtruthjeteta = jet->
get_eta();
393 if (subtruthjeteta < (
etalow - 1) || subtruthjeteta > (
etahigh + 1))
396 float subtruthjetphi = jet->
get_phi();
397 float subtruthjetenergy = jet->
get_e();
401 std::set<PHG4Particle *> truthjetcomp =
402 trutheval->all_truth_particles(jet);
405 for (std::set<PHG4Particle *>::iterator iter3 = truthjetcomp.begin();
406 iter3 != truthjetcomp.end();
412 cout <<
"no truth particles in the jet??" << endl;
415 ntruthconstituents++;
418 if (ntruthconstituents < 2)
421 if (subtruthjetpt > subleading_jet && subtruthjetpt <
cluseventpt)
423 subleading_jet = subtruthjetpt;
445 std::cout <<
" DONE PROCESSING " << endl;
449 PHGenIntegral *phgen = findNode::getClass<PHGenIntegral>(topnode,
"PHGenIntegral");
470 runinfo =
new TTree(
"runinfo",
"a tree with pythia run info like int lumi");
477 truthjettree =
new TTree(
"truthjettree",
"a tree with truth jets");
501 truth_g4particles =
new TTree(
"truthtree_g4",
"a tree with all truth g4 particles");
524 truthtree =
new TTree(
"truthtree",
"a tree with all truth pythia particles");
542 event_tree =
new TTree(
"eventtree",
"A tree with 2 to 2 event info");