39 #include <HepMC/GenEvent.h>
40 #include <HepMC/GenParticle.h>
41 #include <HepMC/SimpleVector.h>
42 #include <HepMC/Units.h>
50 :
SubsysReco(
"JetHepMCLoader_" + jetInputCategory)
51 , m_jetInputCategory(jetInputCategory)
52 , m_saveQAPlots(
false)
72 const int n_bins = 1 +
m_jetSrc.size();
74 TH1D *
h =
new TH1D(
"hNormalization",
75 "Normalization;Items;Summed quantity", n_bins, .5, n_bins + .5);
77 h->GetXaxis()->SetBinLabel(i++,
"Event count");
80 h->GetXaxis()->SetBinLabel(i++, (
string(
"SubEvent ") + src.m_name).c_str());
82 h->GetXaxis()->LabelsOption(
"v");
88 new TH2F((
string(
"hJetEtEta_") + src.m_name).c_str(),
89 (
"Jet distribution from " + src.m_name +
";Jet #eta;Jet E_{T} [GeV]").c_str(),
101 PHHepMCGenEventMap *genevtmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
105 static bool once =
true;
111 cout <<
"HepMCNodeReader::process_event - No PHHepMCGenEventMap node. Do not perform HepMC->Geant4 input" << endl;
121 TH1D *h_norm =
dynamic_cast<TH1D *
>(hm->
getHisto(
"hNormalization"));
123 h_norm->Fill(
"Event count", 1);
128 JetMap *jets = findNode::getClass<JetMap>(topNode, src.m_name);
132 jets->
set_par(src.m_parameter);
136 genevtmap->
get(src.m_embeddingID);
138 if (genevt ==
nullptr)
continue;
140 HepMC::GenEvent *evt = genevt->
getEvent();
143 cout <<
PHWHERE <<
" no evt pointer under HEPMC Node found:";
150 TH2F *hjet =
nullptr;
156 TH1D *h_norm =
dynamic_cast<TH1D *
>(hm->
getHisto(
"hNormalization"));
158 h_norm->Fill((
string(
"SubEvent ") + src.m_name).c_str(), 1);
160 hjet =
dynamic_cast<TH2F *
>(hm->
getHisto(
string(
"hJetEtEta_") + src.m_name));
165 const double mom_factor = HepMC::Units::conversion_factor(evt->momentum_unit(), HepMC::Units::GEV);
167 for (HepMC::GenEvent::particle_const_iterator
p = evt->particles_begin();
168 p != evt->particles_end(); ++
p)
170 HepMC::GenParticle *
part = (*p);
176 if (part->status() == src.m_tagStatus and part->pdg_id() == src.m_tagPID)
180 jet->
set_px(part->momentum().px() * mom_factor);
181 jet->
set_py(part->momentum().py() * mom_factor);
182 jet->
set_pz(part->momentum().pz() * mom_factor);
183 jet->
set_e(part->momentum().e() * mom_factor);
208 cout <<
"JetHepMCLoader::End - saving QA histograms to " <<
Name() +
".root" << endl;
216 const std::string &
name,
223 string algorithmName =
"Undefined_Jet_Algorithm";
228 algorithmName =
"ANTIKT";
232 algorithmName =
"KT";
236 algorithmName =
"CAMBRIDGE";
257 cout <<
PHWHERE <<
"DST Node missing, doing nothing." << endl;
279 JetMap *jets = findNode::getClass<JetMap>(topNode, src.m_name);
284 InputNode->
addNode(JetMapNode);
294 string histname(
Name() +
"_HISTOS");
302 <<
"TPCDataStreamEmulator::get_HistoManager - Making Fun4AllHistoManager " << histname