1#include "Trigger/PropagationMapWriter.h"
8PropagationMapWriter::PropagationMapWriter(
const std::string& name,
10 : Producer(name, process) {}
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;
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,
72void PropagationMapWriter::onProcessEnd() {
#define DECLARE_PRODUCER_NS(NS, CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
Class which encapsulates information from a hit in a simulated tracking detector.
Implements an event buffer system for storing event data.
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.
Class which represents the process under execution.
Class encapsulating parameters for configuring a processor.
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Represents a simulated tracker hit in the simulation.
std::vector< float > getPosition() const
Get the XYZ position of the hit [mm].