18 inTag =
"TargetScoringPlaneHits";
19 if (!event.
exists(inTag))
return;
20 const std::vector<ldmx::SimTrackerHit> hitsTarg =
23 inTag =
"EcalScoringPlaneHits";
24 if (!event.
exists(inTag))
return;
25 const std::vector<ldmx::SimTrackerHit> hitsEcal =
29 for (
const auto& hit : hitsTarg) {
30 if (!(hit.getTrackID() == 1))
continue;
31 if (!(hit.getPdgID() == 11))
continue;
32 auto xyz = hit.getPosition();
33 if (xyz[2] < 0 || xyz[2] > 1)
continue;
36 for (
const auto& hit : hitsEcal) {
37 if (!(hit.getTrackID() == 1))
continue;
38 if (!(hit.getPdgID() == 11))
continue;
39 auto xyz = hit.getPosition();
40 if (xyz[2] < 239.99 || xyz[2] > 240.01)
continue;
46 if (h1.getPdgID() && h2.getPdgID()) {
49 profx_->Fill(h2.getEnergy(), h1.getMomentum()[0] / h1.getEnergy(),
50 h2.getPosition()[0] - h1.getPosition()[0]);
51 profy_->Fill(h2.getEnergy(), h1.getMomentum()[1] / h1.getEnergy(),
52 h2.getPosition()[1] - h1.getPosition()[1]);
60void PropagationMapWriter::onProcessStart() {
62 outFile_ =
new TFile(outPath_.c_str(),
"recreate");
63 outFile_->SetCompressionSettings(209);
66 profx_ =
new TProfile2D(
"profx",
";energy;px/e", 40, 0, 4000, 40, -1, 1, -200,
68 profy_ =
new TProfile2D(
"profy",
";energy;py/e", 40, 0, 4000, 40, -1, 1, -200,
bool exists(const std::string &name, const std::string &passName="", bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.