LDMX Software
TrigScintTrackProducer.h
1
2#ifndef TRIGSCINT_TRIGSCINTTRACKPRODUCER_H
3#define TRIGSCINT_TRIGSCINTTRACKPRODUCER_H
4
5// LDMX Framework
6#include <unordered_set>
7
8#include "Framework/Configure/Parameters.h" // Needed to import parameters from configuration file
9#include "Framework/Event.h"
10#include "Framework/EventProcessor.h" //Needed to declare processor
12#include "TrigScint/Event/TrigScintCluster.h"
13#include "TrigScint/Event/TrigScintTrack.h"
14
15namespace trigscint {
16
22 public:
23 TrigScintTrackProducer(const std::string& name, framework::Process& process)
24 : Producer(name, process) {}
25
27
28 void produce(framework::Event& event) override;
29
30 void onProcessStart() override;
31 void onProcessEnd() override;
32
33 private:
34 // collection of produced tracks
35 std::vector<ldmx::TrigScintTrack> tracks_;
36
37 // add a cluster to a track
38 ldmx::TrigScintTrack makeTrack(std::vector<ldmx::TrigScintCluster> clusters);
39
40 // match x, y tracks and set their x,y spatial coordinates
41 void matchXYTracks(std::vector<ldmx::TrigScintTrack>& tracks);
42 // std::vector<ldmx::TrigScintTrack> matchXYTracks(
43 // std::vector<ldmx::TrigScintTrack> &tracks);
44
45 // maximum difference (in channel number space) between track seed and cluster
46 // in the next pad tolerated to form a track
47 double max_delta_{0.};
48
49 double max_delta_vert_{0.};
50 double bar_length_y_{30.};
51
52 // producer specific verbosity
53 int verbose_{0};
54
55 // collection used to seed the tracks
56 std::string seeding_collection_;
57
58 // other cluster collections used in track making
59 std::vector<std::string> input_collections_;
60
61 // output collection (tracks)
62 std::string output_collection_;
63
64 // specific pass name to use for track making
65 std::string pass_name_{""};
66
67 // allow forming tracks without match in the last collection
68 bool skip_last_{false};
69
70 // do tracking using LUT method instead of with max_delta
71 bool lut_tracking_{false};
72
73 // vertical bar start index
74 int vert_bar_start_idx_{52};
75
76 // number of horizontal bars (one layer) in geometry
77 int n_bars_y_{16};
78
79 // number of vertical bars (one row) in geometry
80 int n_bars_x_{8};
81
82 // track centroid in units of channel nb (will not be content weighted)
83 // float centroid_{0.};
84
85 // track horizontal centroid in units of channel nb (will not be content
86 // weighted)
87 // float centroidX_{-1};
88
89 // track vertical centroid in units of channel nb (will not be content
90 // weighted)
91 // float centroidY_{-1};
92
93 // track residual in units of channel nb (will not be content weighted)
94 // float residual_{0.};
95
96 struct LUTKey {
97 float p1_, p2_, p3_;
98
99 bool operator==(const LUTKey &other) const {
100 return p1_ == other.p1_ && p2_ == other.p2_ && p3_ == other.p3_;
101 }
102 };
103
104 struct LUTKeyHash {
105 size_t operator()(const LUTKey &k) const {
106 return std::hash<float>()(k.p1_) ^ (std::hash<float>()(k.p2_) << 1) ^
107 (std::hash<float>()(k.p3_) << 2);
108 }
109 };
110
111 std::unordered_set<LUTKey, LUTKeyHash> lut_;
112
113 float bar_width_y_{3.}; // mm
114 float bar_gap_y_{2.1}; // mm
115 float bar_width_x_{3.}; // mm
116 float bar_gap_x_{0.1}; // mm
117
118 float x_conv_factor_; // geometry conversion factors
119 float x_start_;
120 float y_conv_factor_;
121 float y_start_;
122};
123
124} // namespace trigscint
125
126#endif // TRIGSCINT_TRIGSCINTTRACKPRODUCER_H
Class providing string constants for the event model.
Base classes for all user event processing components to extend.
Class implementing an event buffer system for storing event data.
Implements an event buffer system for storing event data.
Definition Event.h:42
Class which represents the process under execution.
Definition Process.h:37
Base class for a module which produces a data product.
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
Represents a track of trigger scintillator clusters.
making tracks from trigger scintillator clusters
void configure(framework::config::Parameters &ps) 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 produce(framework::Event &event) override
Process the event and put new data products into it.
void onProcessStart() override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...