LDMX Software
RecoilTrackerDQM.cxx
Go to the documentation of this file.
1
8
10#include "TVector3.h"
11
12namespace dqm {
13
14RecoilTrackerDQM::RecoilTrackerDQM(const std::string &name,
15 framework::Process &process)
16 : framework::Analyzer(name, process) {}
17
19
21
23
25 // If the collection of findable tracks doesn't exist, stop processing
26 // the event.
27 if (!event.exists("FindableTracks")) return;
28
29 auto recoilTrackID = 0;
30 // Get the collection of simulated particles from the event
31 /*const std::vector<FindableTrackResult> tracks
32 = event.getCollection<FindableTrackResult>("FindableTracks");
33
34 TrackMaps map = Analysis::getFindableTrackMaps(tracks);
35
36 histograms_.fill("track_count",map.findable.size());
37 histograms_.fill("loose_track_count",map.loose.size());
38 histograms_.fill("axial_track_count",map.axial.size());
39
40 // Get the collection of simulated particles from the event
41 auto particleMap{event.getMap<int, ldmx::SimParticle>("SimParticles")};
42
43 // Search for the recoil electron
44 auto [recoilTrackID, recoil] = Analysis::getRecoil(particleMap);
45
46 auto it = map.findable.find(recoilTrackID);
47 bool recoilIsFindable = ( it != map.findable.end() );
48
49 // Fill the recoil vertex position histograms
50 std::vector<double> recoilVertex = recoil->getVertex();
51 histograms_.fill("recoil_vx",recoilVertex[0]);
52 histograms_.fill("recoil_vy",recoilVertex[1]);
53 histograms_.fill("recoil_vz",recoilVertex[2]); */
54
55 double p{-1}, pt{-1}, px{-9999}, py{-9999}, pz{-9999};
56 const ldmx::SimTrackerHit *spHit{nullptr};
57 if (event.exists("TargetScoringPlaneHits")) {
58 // Get the collection of simulated particles from the event
59 const std::vector<ldmx::SimTrackerHit> spHits =
60 event.getCollection<ldmx::SimTrackerHit>("TargetScoringPlaneHits");
61
62 for (const ldmx::SimTrackerHit &hit : spHits) {
63 if ((hit.getTrackID() == recoilTrackID) /*hit caused by recoil*/ and
64 (hit.getLayerID() == 2) /*hit on downstream side of target*/ and
65 (hit.getMomentum()[2] > 0) /*hit momentum leaving target*/
66 ) {
67 spHit = &hit;
68 break;
69 }
70 }
71
72 if (spHit) {
73 TVector3 recoilP(spHit->getMomentum().data());
74
75 p = recoilP.Mag();
76 pt = recoilP.Pt();
77 px = recoilP.Px();
78 py = recoilP.Py();
79 pz = recoilP.Pz();
80 }
81 }
82
83 histograms_.fill("tp", p);
84 histograms_.fill("tpt", pt);
85 histograms_.fill("tpx", px);
86 histograms_.fill("tpy", py);
87 histograms_.fill("tpz", pz);
88
89 bool passesTrackVeto{false};
90 // Check if the TrackerVeto result exists
91 if (event.exists("TrackerVeto")) {
92 // Get the collection of trackerVeto results
93 /*const TrackerVetoResult trackerVeto =
94 event.getObject<TrackerVetoResult>("TrackerVeto");
95
96 // Check if the event passes the tracker veto
97 if (trackerVeto.passesVeto()) {
98 passesTrackVeto = true;
99 }*/
100 }
101
102 if (passesTrackVeto) {
103 histograms_.fill("tp_track_veto", p);
104 histograms_.fill("tpt_track_veto", pt);
105 histograms_.fill("tpx_track_veto", px);
106 histograms_.fill("tpy_track_veto", py);
107 histograms_.fill("tpz_track_veto", pz);
108 }
109}
110
111} // namespace dqm
112
113DECLARE_ANALYZER_NS(dqm, RecoilTrackerDQM)
#define DECLARE_ANALYZER_NS(NS, CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Analyzer used for DQM of the Recoil tracker.
Class which encapsulates information from a hit in a simulated tracking detector.
void configure(framework::config::Parameters &parameters) override
Configure the processor using the given user specified parameters.
void onProcessStart() override
Method executed before processing of events begins.
virtual ~RecoilTrackerDQM()
Destructor.
void analyze(const framework::Event &event) override
Process the event and make histograms ro summaries.
RecoilTrackerDQM(const std::string &name, framework::Process &process)
Constructor.
HistogramHelper histograms_
Interface class for making and filling histograms.
Implements an event buffer system for storing event data.
Definition Event.h:41
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.
Definition Event.cxx:92
void fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
Represents a simulated tracker hit in the simulation.
All classes in the ldmx-sw project use this namespace.
Definition PerfDict.cxx:45