MarlinTPC  1.2.0
TrackSeederProcessor.h
1 #ifndef TRACKSEEDERPROCESSOR_H
2 #define TRACKSEEDERPROCESSOR_H 1
3 
4 #include <set>
5 #include "marlin/Processor.h"
6 #include "lcio.h"
7 #include <string>
8 #include <vector>
9 
10 #include <EVENT/TrackerHit.h>
11 
12 namespace marlintpc
13 {
14 
59 class TrackSeederProcessor : public marlin::Processor
60 {
61 
62  public:
63 
67 
68 
72 
73 
76  Processor * newProcessor();
77 
78 
81  void init();
82 
83 
86  void processRunHeader(lcio::LCRunHeader *run);
87 
88 
91  virtual void processEvent(lcio::LCEvent *evt);
92 
93 
96  virtual void check(lcio::LCEvent *evt);
97 
98 
101  virtual void end();
102 
103  private:
104 
107  std::string _input_track_candidates_collection_name;
108 
111  std::string _output_seed_tracks_collection_name;
112 
117  int _outputIsTransient; //< if not 0 the hits collection is set transient (default 0)
118 
121  bool _produce_s_z_tuples;
122 
125  double _radius_threshold;
126 
129  std::string _tpc_conditions_collection_name;
130 
134  std::vector<double> calculate_least_squares_line(std::vector< std::pair<double, double> > points);
135 
139  std::vector<double> calculate_least_squares_circle(std::vector< std::pair<double, double> > points);
140 
141 
145  class sort_by_distance_from_point
146  {
147 
148  public:
149  sort_by_distance_from_point(double x, double y, double z):
150  _x(x),
151  _y(y),
152  _z(z) {};
153 
154  bool operator()(EVENT::TrackerHit* hit1, EVENT::TrackerHit* hit2)
155  {
156  double dx = _x - hit1->getPosition()[0];
157  double dy = _y - hit1->getPosition()[1];
158  double dz = _z - hit1->getPosition()[2];
159 
160  const double d1 = sqrt(dx * dx + dy * dy + dz * dz);
161 
162  dx = _x - hit2->getPosition()[0];
163  dy = _y - hit2->getPosition()[1];
164  dz = _z - hit2->getPosition()[2];
165 
166  const double d2 = sqrt(dx * dx + dy * dy + dz * dz);
167 
168  return (d1 < d2);
169  }
170  private:
171  // the point the distance is calculated from
172  double _x, _y, _z;
173  };
174 
178  class sort_by_z
179  {
180  public:
181  bool operator()(std::pair<double, double> sz1, std::pair<double, double> sz2)
182  {
183  return (sz1.second < sz2.second);
184  }
185  };
186 
187 // /// The pad layout as defined in GEAR
188 // gear::PadRowLayout2D const *_padLayout;
189 // int _padLayoutType; ///< Pad layout type (PadRowLayout2D::CARTESIAN or PadRowLayout2D::POLAR)
190 
191 };
192 
193 }// namespace marlintoc
194 
195 #endif // TRACKSEEDERPROCESSOR_H
196 
197 
198 
virtual void end()
Called after data processing for clean up in the inverse order of the init() method so that resources...
Definition: TrackSeederProcessor.cc:534
void init()
Called at the begin of the job before anything is read.
Definition: TrackSeederProcessor.cc:88
TrackSeederProcessor takes the TrackerHits of each track and calculates initial track parameters to h...
Definition: TrackSeederProcessor.h:59
Processor * newProcessor()
Return a new instance of this processor.
Definition: TrackSeederProcessor.cc:520
~TrackSeederProcessor()
Destructor.
Definition: TrackSeederProcessor.cc:82
virtual void processEvent(lcio::LCEvent *evt)
Called for every event - the working horse.
Definition: TrackSeederProcessor.cc:136
TrackSeederProcessor()
Default constructor.
Definition: TrackSeederProcessor.cc:48
void processRunHeader(lcio::LCRunHeader *run)
Called once per run to process the event's header.
Definition: TrackSeederProcessor.cc:121
virtual void check(lcio::LCEvent *evt)
Called for every event - right after processEvent() has been called for all processors.
Definition: TrackSeederProcessor.cc:527