38 #pragma GCC diagnostic push
39 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
40 #include <HepMC/GenEvent.h>
41 #pragma GCC diagnostic pop
43 #include <HepMC/GenParticle.h>
44 #include <HepMC/SimpleVector.h>
45 #include <HepMC/Units.h>
52 :
SubsysReco(
"JetHepMCLoader_" + jetInputCategory)
53 , m_jetInputCategory(jetInputCategory)
65 const int n_bins = 1 +
m_jetSrc.size();
67 TH1D *
h =
new TH1D(
"hNormalization",
68 "Normalization;Items;Summed quantity", n_bins, .5, n_bins + .5);
70 h->GetXaxis()->SetBinLabel(i++,
"Event count");
73 h->GetXaxis()->SetBinLabel(i++, (
std::string(
"SubEvent ") + src.m_name).c_str());
75 h->GetXaxis()->LabelsOption(
"v");
81 new TH2F((
std::string(
"hJetEtEta_") + src.m_name).c_str(),
82 (
"Jet distribution from " + src.m_name +
";Jet #eta;Jet E_{T} [GeV]").c_str(),
94 PHHepMCGenEventMap *genevtmap = findNode::getClass<PHHepMCGenEventMap>(topNode,
"PHHepMCGenEventMap");
98 static bool once =
true;
104 std::cout <<
"HepMCNodeReader::process_event - No PHHepMCGenEventMap node. Do not perform HepMC->Geant4 input" << std::endl;
114 TH1D *h_norm =
dynamic_cast<TH1D *
>(hm->
getHisto(
"hNormalization"));
116 h_norm->Fill(
"Event count", 1);
121 JetContainer *jets = findNode::getClass<JetContainer>(topNode, src.m_name);
125 jets->
set_par(src.m_parameter);
130 if (genevt ==
nullptr)
continue;
132 HepMC::GenEvent *evt = genevt->
getEvent();
135 std::cout <<
PHWHERE <<
" no evt pointer under HEPMC Node found:";
142 TH2F *hjet =
nullptr;
148 TH1D *h_norm =
dynamic_cast<TH1D *
>(hm->
getHisto(
"hNormalization"));
150 h_norm->Fill((
std::string(
"SubEvent ") + src.m_name).c_str(), 1);
157 const double mom_factor = HepMC::Units::conversion_factor(evt->momentum_unit(), HepMC::Units::GEV);
159 for (HepMC::GenEvent::particle_const_iterator
p = evt->particles_begin();
160 p != evt->particles_end(); ++
p)
162 HepMC::GenParticle *part = (*p);
170 if (part->status() == src.m_tagStatus and part->pdg_id() == src.m_tagPID)
174 jet->
set_px(part->momentum().px() * mom_factor);
175 jet->
set_py(part->momentum().py() * mom_factor);
176 jet->
set_pz(part->momentum().pz() * mom_factor);
177 jet->
set_e(part->momentum().e() * mom_factor);
199 std::cout <<
"JetHepMCLoader::End - saving QA histograms to " <<
Name() +
".root" << std::endl;
214 std::string algorithmName =
"Undefined_Jet_Algorithm";
219 algorithmName =
"ANTIKT";
223 algorithmName =
"KT";
227 algorithmName =
"CAMBRIDGE";
248 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
270 JetContainer *jets = findNode::getClass<JetContainer>(topNode, src.m_name);
275 InputNode->
addNode(JetContainerNode);
293 <<
"TPCDataStreamEmulator::get_HistoManager - Making Fun4AllHistoManager " << histname