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
11#include "TrigScint/Event/TrigScintCluster.h"
12#include "TrigScint/Event/TrigScintTrack.h"
13
14namespace trigscint {
15
21 public:
22 TrigScintTrackProducer(const std::string& name, framework::Process& process)
23 : Producer(name, process) {}
24
26
27 void produce(framework::Event& event) override;
28
29 void onProcessStart() override;
30 void onProcessEnd() override;
31
32 private:
33 // collection of produced tracks
34 std::vector<ldmx::TrigScintTrack> tracks_;
35
36 // add a cluster to a track
37 ldmx::TrigScintTrack makeTrack(std::vector<ldmx::TrigScintCluster> clusters);
38
39 // match x, y tracks and set their x,y spatial coordinates
40 void matchXYTracks(std::vector<ldmx::TrigScintTrack>& tracks);
41 // std::vector<ldmx::TrigScintTrack> matchXYTracks(
42 // std::vector<ldmx::TrigScintTrack> &tracks);
43
44 // maximum difference (in channel number space) between track seed and cluster
45 // in the next pad tolerated to form a track
46 double max_delta_{0.};
47
48 double max_delta_vert_{0.};
49 double bar_length_y_{30.};
50
51 // producer specific verbosity
52 int verbose_{0};
53
54 // collection used to seed the tracks
55 std::string seeding_collection_;
56
57 // other cluster collections used in track making
58 std::vector<std::string> input_collections_;
59
60 // output collection (tracks)
61 std::string output_collection_;
62
63 // specific pass name to use for track making
64 std::string pass_name_{""};
65
66 // allow forming tracks without match in the last collection
67 bool skip_last_{false};
68
69 // do tracking using LUT method instead of with max_delta
70 bool lut_tracking_{false};
71
72 // vertical bar start index
73 int vert_bar_start_idx_{52};
74
75 // number of horizontal bars (one layer) in geometry
76 int n_bars_y_{16};
77
78 // number of vertical bars (one row) in geometry
79 int n_bars_x_{8};
80
81 // track centroid in units of channel nb (will not be content weighted)
82 // float centroid_{0.};
83
84 // track horizontal centroid in units of channel nb (will not be content
85 // weighted)
86 // float centroidX_{-1};
87
88 // track vertical centroid in units of channel nb (will not be content
89 // weighted)
90 // float centroidY_{-1};
91
92 // track residual in units of channel nb (will not be content weighted)
93 // float residual_{0.};
94
95 struct LUTKey {
96 float p1_, p2_, p3_;
97
98 bool operator==(const LUTKey& other) const {
99 return p1_ == other.p1_ && p2_ == other.p2_ && p3_ == other.p3_;
100 }
101 };
102
103 struct LUTKeyHash {
104 size_t operator()(const LUTKey& k) const {
105 return std::hash<float>()(k.p1_) ^ (std::hash<float>()(k.p2_) << 1) ^
106 (std::hash<float>()(k.p3_) << 2);
107 }
108 };
109
110 std::unordered_set<LUTKey, LUTKeyHash> lut_;
111
112 float bar_width_y_{3.}; // mm
113 float bar_gap_y_{2.1}; // mm
114 float bar_width_x_{3.}; // mm
115 float bar_gap_x_{0.1}; // mm
116
117 float x_conv_factor_; // geometry conversion factors
118 float x_start_;
119 float y_conv_factor_;
120 float y_start_;
121};
122
123} // namespace trigscint
124
125#endif // TRIGSCINT_TRIGSCINTTRACKPRODUCER_H
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:40
Class which represents the process under execution.
Definition Process.h:34
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:26
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,...