17 #pragma GCC diagnostic push
18 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
19 #include <HepMC/GenEvent.h>
20 #include <HepMC/GenVertex.h>
21 #pragma GCC diagnostic pop
25 #include <TDatabasePDG.h>
31 #include <g4jets/JetMap.h>
32 #include <g4jets/Jet.h>
33 #include <g4jets/Jetv1.h>
41 , _do_photon_tagging()
69 PHG4TruthInfoContainer* truthcontainer = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo");
73 <<
"MyJetAnalysis::process_event - Error can not find DST truthcontainer node "
77 PHHepMCGenEventMap* geneventmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
80 std::cout <<
PHWHERE <<
" - Fatal error - missing node PHHepMCGenEventMap" << std::endl;
87 std::cout <<
PHWHERE <<
" - Fatal error - node PHHepMCGenEventMap missing subevent with embedding ID " <<
_embedding_id;
88 std::cout <<
". Print PHHepMCGenEventMap:";
95 HepMC::GenEvent* theEvent = genevt->
getEvent();
98 int n_radii =
_radii.size();
101 if (n_radii != n_algo)
103 std::cout <<
"TruthJetTagging::process_event - errorr unequal number of jet radii and algoirthms specified" << std::endl;
107 for (
int algoiter = 0;algoiter < n_algo;algoiter++)
109 JetMap* tjets = findNode::getClass<JetMap>(topNode,
_algorithms.at(algoiter).c_str());
113 <<
"MyJetAnalysis::process_event - Error can not find DST JetMap node "
119 Jet* tjet = iter->second;
130 float jet_radius = 0.4;
144 float jetpt = tjet->
get_pt();
145 float max_gamma_pt = 0;
151 float particle_pt = TMath::Sqrt(TMath::Power(particle->
get_px(),2) + TMath::Power(particle->
get_py(),2));
152 if (particle_pt > max_gamma_pt)
154 max_gamma_pt = particle_pt;
158 float ratio = max_gamma_pt/jetpt;
168 const double match_radius)
170 float this_pt = this_jet->
get_pt();
171 float this_phi = this_jet->
get_phi();
172 float this_eta = this_jet->
get_eta();
175 double jet_parton_zt = 0;
177 for (HepMC::GenEvent::particle_const_iterator
p = theEvent->particles_begin();
178 p != theEvent->particles_end(); ++
p)
180 float dR =
deltaR((*p)->momentum().pseudoRapidity(), this_eta,
181 (*p)->momentum().phi(), this_phi);
182 if (dR > match_radius)
186 TParticlePDG* pdg_p = TDatabasePDG::Instance()->GetParticle((*p)->pdg_id());
189 if (TString(pdg_p->ParticleClass()).BeginsWith(
"B-"))
191 pidabs = TDatabasePDG::Instance()->GetParticle(
"b")->PdgCode();
193 else if (TString(pdg_p->ParticleClass()).BeginsWith(
"Charmed"))
195 pidabs = TDatabasePDG::Instance()->GetParticle(
"c")->PdgCode();
199 const double zt = (*p)->momentum().perp() / this_pt;
201 if (pidabs == TDatabasePDG::Instance()->GetParticle(
"c")->PdgCode()
202 or pidabs == TDatabasePDG::Instance()->GetParticle(
"b")->PdgCode())
204 if (pidabs > abs(jet_flavor))
209 else if (pidabs == abs(jet_flavor))
211 if (zt > jet_parton_zt)
304 std::cout <<
"TruthJetTagging::Print(const std::string &what) const Printing info for " << what << std::endl;