26 in_tag =
"TargetScoringPlaneHits";
27 if (!event.
exists(in_tag, target_sp_hits_events_passname_))
return;
28 const std::vector<ldmx::SimTrackerHit> hits_targ =
30 target_scoring_plane_passname_);
32 in_tag =
"EcalScoringPlaneHits";
33 if (!event.
exists(in_tag, ecal_sp_hits_events_passname_))
return;
34 const std::vector<ldmx::SimTrackerHit> hits_ecal =
36 ecal_scoring_plane_passname_);
39 for (
const auto& hit : hits_targ) {
40 if (!(hit.getTrackID() == 1))
continue;
41 if (!(hit.getPdgID() == 11))
continue;
42 auto xyz = hit.getPosition();
43 if (xyz[2] < 0 || xyz[2] > 1)
continue;
46 for (
const auto& hit : hits_ecal) {
47 if (!(hit.getTrackID() == 1))
continue;
48 if (!(hit.getPdgID() == 11))
continue;
49 auto xyz = hit.getPosition();
50 if (xyz[2] < 239.99 || xyz[2] > 240.01)
continue;
56 if (h1.getPdgID() && h2.getPdgID()) {
59 profx_->Fill(h2.getEnergy(), h1.getMomentum()[0] / h1.getEnergy(),
60 h2.getPosition()[0] - h1.getPosition()[0]);
61 profy_->Fill(h2.getEnergy(), h1.getMomentum()[1] / h1.getEnergy(),
62 h2.getPosition()[1] - h1.getPosition()[1]);
70void PropagationMapWriter::onProcessStart() {
72 out_file_ =
new TFile(out_path_.c_str(),
"recreate");
73 out_file_->SetCompressionSettings(209);
76 profx_ =
new TProfile2D(
"profx",
";energy;px/e", 40, 0, 4000, 40, -1, 1, -200,
78 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.