LDMX Software
TrackComparisonProcessor.h
1#ifndef TRACKING_RECO_TRACKCOMPARISONPROCESSOR_H_
2#define TRACKING_RECO_TRACKCOMPARISONPROCESSOR_H_
3
4#include <map>
5#include <string>
6#include <vector>
7
8#include "Framework/Configure/Parameters.h"
9#include "Framework/Event.h"
11#include "SimCore/Event/SimParticle.h"
12#include "TFile.h"
13#include "TTree.h"
14#include "Tracking/Event/Track.h"
15
16namespace tracking::reco {
17
29 public:
30 TrackComparisonProcessor(const std::string& name,
32 ~TrackComparisonProcessor() = default;
33
34 void configure(framework::config::Parameters& parameters) override;
35 void onProcessStart() override;
36 void analyze(const framework::Event& event) override;
37 void onProcessEnd() override;
38
39 private:
40 struct PairVars {
41 int track_id{-1};
42 float truth_prob_s{-1}, truth_prob_d{-1};
43 int nhits_s{-1}, nhits_d{-1};
44 float chi2ndf_s{-999}, chi2ndf_d{-999};
45 float d0_s{-999}, d0_d{-999};
46 float z0_s{-999}, z0_d{-999};
47 float phi_s{-999}, phi_d{-999};
48 float theta_s{-999}, theta_d{-999};
49 float qop_s{-999}, qop_d{-999};
50 float p_s{-999}, p_d{-999};
51 float delta_d0{-999}, delta_z0{-999};
52 float delta_phi{-999}, delta_theta{-999};
53 float delta_p_over_p{-999};
54 float px_s{-999}, py_s{-999}, pz_s{-999};
55 float px_d{-999}, py_d{-999}, pz_d{-999};
56 // truth (SimParticle)
57 float px_t{-999}, py_t{-999}, pz_t{-999};
58 float p_t{-999};
59 float vx_t{-999}, vy_t{-999}, vz_t{-999};
60 float delta_p_over_p_s{-999}, delta_p_over_p_d{-999};
61 };
62
63 void setupTree(TTree* tree, PairVars& v);
64 void fillPair(const ldmx::Track& smear, const ldmx::Track& digi,
65 const ldmx::SimParticle& truth, PairVars& v,
66 const std::string& prefix);
67 void processTracker(const framework::Event& event,
68 const std::string& coll_smear,
69 const std::string& pass_smear,
70 const std::string& coll_digi,
71 const std::string& pass_digi, TTree* tree, PairVars& vars,
72 const std::string& histo_prefix);
73
74 // configuration
75 std::string trk_collection_smear_{"TaggerTracks"};
76 std::string trk_collection_digi_{"TaggerDigiTracks"};
77 std::string pass_name_smear_{""};
78 std::string pass_name_digi_{""};
79 bool do_tagger_{true};
80 bool do_recoil_{false};
81 std::string recoil_collection_smear_{"RecoilTracks"};
82 std::string recoil_collection_digi_{"RecoilDigiTracks"};
83 std::string recoil_pass_smear_{""};
84 std::string recoil_pass_digi_{""};
85 double min_truth_prob_{0.5};
86 std::string sim_particles_pass_{""};
87 std::string output_file_{"track_comparison.root"};
88
89 // output
90 TFile* file_{nullptr};
91 TTree* tagger_tree_{nullptr};
92 TTree* recoil_tree_{nullptr};
93 PairVars tagger_vars_;
94 PairVars recoil_vars_;
95};
96
97} // namespace tracking::reco
98
99#endif // TRACKING_RECO_TRACKCOMPARISONPROCESSOR_H_
Base classes for all user event processing components to extend.
Class implementing an event buffer system for storing event data.
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:37
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Class representing a simulated particle.
Definition SimParticle.h:24
Implementation of a track object.
Definition Track.h:53
Compares tracking performance between a truth-smeared hit chain and a charge-digitized hit chain on a...
void onProcessStart() override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
void configure(framework::config::Parameters &parameters) override
Callback for the EventProcessor to configure itself from the given set of parameters.
void onProcessEnd() override
Callback for the EventProcessor to take any necessary action when the processing of events finishes,...
void analyze(const framework::Event &event) override
Process the event and make histograms or summaries.