LDMX Software
Public Member Functions | List of all members
dqm::RecoilTrackerDQM Class Reference

Public Member Functions

 RecoilTrackerDQM (const std::string &name, framework::Process &process)
 Constructor.
 
virtual ~RecoilTrackerDQM ()
 Destructor.
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified parameters.
 
void analyze (const framework::Event &event) override
 Process the event and make histograms ro summaries.
 
void onProcessStart () override
 Method executed before processing of events begins.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Analyzer
static const int CLASSTYPE {2}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 30 of file RecoilTrackerDQM.h.

Constructor & Destructor Documentation

◆ RecoilTrackerDQM()

dqm::RecoilTrackerDQM::RecoilTrackerDQM ( const std::string &  name,
framework::Process process 
)

Constructor.

Definition at line 14 of file RecoilTrackerDQM.cxx.

16 : framework::Analyzer(name, process) {}
Base class for a module which does not produce a data product.

◆ ~RecoilTrackerDQM()

dqm::RecoilTrackerDQM::~RecoilTrackerDQM ( )
virtual

Destructor.

Definition at line 18 of file RecoilTrackerDQM.cxx.

18{}

Member Function Documentation

◆ analyze()

void dqm::RecoilTrackerDQM::analyze ( const framework::Event event)
overridevirtual

Process the event and make histograms ro summaries.

Parameters
eventThe event to analyze.

Implements framework::Analyzer.

Definition at line 24 of file RecoilTrackerDQM.cxx.

24 {
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}
HistogramHelper histograms_
Interface class for making and filling histograms.
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
Represents a simulated tracker hit in the simulation.

References framework::Event::exists(), framework::HistogramHelper::fill(), and framework::EventProcessor::histograms_.

◆ configure()

void dqm::RecoilTrackerDQM::configure ( framework::config::Parameters parameters)
overridevirtual

Configure the processor using the given user specified parameters.

Parameters
parametersSet of parameters used to configure this processor.

Reimplemented from framework::EventProcessor.

Definition at line 22 of file RecoilTrackerDQM.cxx.

22{}

◆ onProcessStart()

void dqm::RecoilTrackerDQM::onProcessStart ( )
overridevirtual

Method executed before processing of events begins.

Reimplemented from framework::EventProcessor.

Definition at line 20 of file RecoilTrackerDQM.cxx.

20{}

The documentation for this class was generated from the following files: