LDMX Software
TrackingRecoDQM.h
1#pragma once
2
3#include <algorithm>
4#include <iostream>
5
6#include "Framework/Configure/Parameters.h"
7#include "Framework/Event.h"
10#include "Tracking/Event/Measurement.h"
11#include "Tracking/Event/Track.h"
12#include "Tracking/Event/TruthTrack.h"
13#include "Tracking/Sim/TrackingUtils.h"
14
15namespace tracking::dqm {
16
17enum PIDBins {
18 kminus = -4,
19 antiproton,
20 piminus,
21 positron,
22 electron,
23 piplus,
24 proton,
25 kplus
26};
27
29 public:
30 TrackingRecoDQM(const std::string& name, framework::Process& process)
32
34 ~TrackingRecoDQM() = default;
35
36 void analyze(const framework::Event& event) override;
37
38 void trackMonitoring(const std::vector<ldmx::Track>& tracks,
39 const std::vector<ldmx::Measurement>& measurements,
40 const std::string title, const bool& doDetail,
41 const bool& doTruth);
42
43 void efficiencyPlots(const std::vector<ldmx::Track>& tracks,
44 const std::vector<ldmx::Measurement>& measurements,
45 const std::string& title);
46
54 void trackStateMonitoring(const ldmx::Tracks& tracks,
55 ldmx::TrackStateType ts_type,
56 const std::string& ts_title);
63 void configure(framework::config::Parameters& parameters) override;
64
65 void onProcessEnd() override;
66
67 void sortTracks(const std::vector<ldmx::Track>& tracks,
68 std::vector<ldmx::Track>& uniqueTracks,
69 std::vector<ldmx::Track>& duplicateTracks,
70 std::vector<ldmx::Track>& fakeTracks);
71
72 private:
73 std::string track_collection_;
74 std::string truth_collection_;
75 std::string measurement_collection_;
76 std::string measurement_passname_;
77
78 std::string ecal_sp_events_passname_;
79 std::string ecal_sp_passname_;
80 std::string target_sp_events_passname_;
81 std::string target_sp_passname_;
82 std::string track_collection_events_passname_;
83 std::string track_passname_;
84 std::string truth_events_passname_;
85 std::string truth_passname_;
86
87 std::string title_{"tagger_trk_"};
88 double track_prob_cut_{0.5};
89 std::string subdetector_{"Tagger"};
90 bool do_truth_comparison_{false};
91 std::vector<std::string> track_states_;
92
93 // Truth Track collection
94 std::shared_ptr<ldmx::Tracks> truth_track_collection_{nullptr};
95
96 // Ecal scoring plane hits_
97 std::shared_ptr<std::vector<ldmx::SimTrackerHit>> ecal_scoring_hits_{nullptr};
98
99 // Target scoring plane hits_
100 std::shared_ptr<std::vector<ldmx::SimTrackerHit>> target_scoring_hits_{
101 nullptr};
102
103 // If I have truth information, sort the tracks vector according to their
104 // trackID and truthProb
105 // real tracks (truth_prob > cut), unique
106 std::vector<ldmx::Track> unique_tracks_;
107 // real tracks (truth_prob > cut), duplicated
108 std::vector<ldmx::Track> duplicate_tracks_;
109 // fake tracks (truth_prob < cut)
110 std::vector<ldmx::Track> fake_tracks_;
111
112 // PID mapping
113 std::map<int, int> pidmap_;
114};
115} // namespace tracking::dqm
Base classes for all user event processing components to extend.
Class implementing an event buffer system for storing event data.
Class which encapsulates information from a hit in a simulated tracking detector.
Base class for a module which does not produce a data product.
virtual void process(Event &event) final
Processing an event for an Analyzer is calling analyze.
Implements an event buffer system for storing event data.
Definition Event.h:42
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
~TrackingRecoDQM()=default
Destructor.
void onProcessEnd() override
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
void configure(framework::config::Parameters &parameters) override
Configure the analyzer using the given user specified parameters.
void analyze(const framework::Event &event) override
Process the event and make histograms or summaries.
void trackStateMonitoring(const ldmx::Tracks &tracks, ldmx::TrackStateType ts_type, const std::string &ts_title)
Monitoring plots for tracks extrapolated to the ECAL Scoring plane.