14 #include <fastjet/ClusterSequence.hh>
15 #include <fastjet/JetDefinition.hh>
16 #include <fastjet/PseudoJet.hh>
19 #include <g4jets/JetMap.h>
35 #pragma GCC diagnostic push
36 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
37 #include <HepMC/GenEvent.h>
38 #include <HepMC/GenParticle.h>
39 #include <HepMC/GenVertex.h>
40 #include <HepMC/IteratorRange.h>
41 #include <HepMC/SimpleVector.h>
42 #include <HepMC/GenParticle.h>
43 #pragma GCC diagnostic pop
48 m_outputFilename(fileout)
50 std::cout <<
"jetHistogrammer::jetHistogrammer(const std::string &name) Calling ctor" << std::endl;
59 std::cout <<
"jetHistogrammer::~jetHistogrammer() Calling dtor" << std::endl;
66 std::cout <<
"jetHistogrammer::Init(PHCompositeNode *topNode) Initializing" << std::endl;
70 Float_t
bins[nBins+1];
71 for(
int i = 0;
i < nBins+1;
i++) bins[
i] = 80./nBins*
i;
73 for(
int i = 0;
i <
nEtaBins;
i++)
ptGJet[
i] =
new TH1F(Form(
"geantJets_%dEta",
i),
"jets reco'd in GEANT world",nBins,bins);
76 ptPJet =
new TH1F(
"pythiaJets",
"jets reco'd in pythia world",nBins,bins);
86 std::cout <<
"jetHistogrammer::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl;
94 JetMap* jetsMC = findNode::getClass<JetMap>(topNode,
"AntiKt_Truth_r04");
97 std::cout <<
"jetHistogrammer::process_event Cannot find truth node!" << std::endl;
101 PHHepMCGenEventMap *genEventMap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
104 std::cout <<
"jetHistogrammer::process_event Cannot find genEventMap!" << std::endl;
111 std::cout <<
"jetHistogrammer::process_event Cannot find genEvent!" << std::endl;
115 HepMC::GenEvent *theEvent = genEvent -> getEvent();
122 Jet *truthjet = iter -> second;
124 if(truthjet -> get_pt() > maxJetPt)
126 maxJetPt = truthjet -> get_pt();
127 maxEta = truthjet -> get_eta();
142 std::vector<fastjet::PseudoJet> pseudojets;
144 for(HepMC::GenEvent::particle_const_iterator
p = theEvent -> particles_begin();
p != theEvent -> particles_end(); ++
p)
146 if(!(*p) ->
status())
continue;
154 if (abs((*p) -> pdg_id() >= 12) && abs((*p) -> pdg_id() <= 16))
continue;
157 if (((*p) ->
momentum().px() == 0.0) && ((*p) ->
momentum().py() == 0.0))
continue;
159 if (abs((*p) ->
momentum().pseudoRapidity()) > 1.5)
continue;
161 fastjet::PseudoJet pseudojet((*p)->momentum().px(),
162 (*p)->momentum().py(),
163 (*p)->momentum().pz(),
164 (*p)->momentum().e());
165 pseudojet.set_user_index(i);
166 pseudojets.push_back(pseudojet);
171 fastjet::ClusterSequence jetFinder(pseudojets, *jetDef);
172 std::vector<fastjet::PseudoJet> fastjets = jetFinder.inclusive_jets();
176 for(
unsigned int ijet = 0; ijet < fastjets.size(); ++ijet)
178 const double pt = sqrt(fastjets[ijet].px() * fastjets[ijet].px() + fastjets[ijet].py() * fastjets[ijet].py());
179 if(pt > maxJetPt) maxJetPt =
pt;
197 std::cout <<
"jetHistogrammer::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl;
205 std::cout <<
"jetHistogrammer opening output file: " <<
m_outputFilename << std::endl;
210 std::cout <<
"jetHistogrammer::End(PHCompositeNode *topNode) This is the End..." << std::endl;
217 std::cout <<
"jetHistogrammer::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
224 std::cout <<
"jetHistogrammer::Print(const std::string &what) const Printing info for " << what << std::endl;
232 if(sqrt(pow(eta,2)) >=
etaBins[
i] && sqrt(pow(eta,2)) <
etaBins[
i+1]) etaBin =
i;