MarlinTrkProcessors  2.4.1
TrackFinderFTF.h
1 #ifndef TrackFinderFTF_h
2 #define TrackFinderFTF_h 1
3 
4 #include "marlin/Processor.h"
5 #include "lcio.h"
6 #include <string>
7 
8 #include <UTIL/LCRelationNavigator.h>
9 
10 #include <EVENT/TrackerHit.h>
11 
12 #include <UTIL/BitField64.h>
13 #include <UTIL/ILDConf.h>
14 
15 
16 namespace MarlinTrk{
17  class IMarlinTrkSystem ;
18 }
19 
20 namespace ftf {
21  class TrackFinder ;
22  class TrackFindingParameters ;
23 }
24 
40 class TrackFinderFTF : public marlin::Processor {
41 
42 public:
43 
44  virtual marlin::Processor* newProcessor() { return new TrackFinderFTF ; }
45 
46  TrackFinderFTF() ;
47 
51  virtual void init() ;
52 
55  virtual void processRunHeader( lcio::LCRunHeader* run ) ;
56 
59  virtual void processEvent( lcio::LCEvent * evt ) ;
60 
61 
62  virtual void check( lcio::LCEvent * evt ) ;
63 
64 
67  virtual void end() ;
68 
69 
70  struct compare_r {
71  bool operator()( EVENT::TrackerHit* a, EVENT::TrackerHit* b) const {
72  // double r_a_sqd = a->getPosition()[0] * a->getPosition()[0] + a->getPosition()[1] * a->getPosition()[1] ;
73  // double r_b_sqd = b->getPosition()[0] * b->getPosition()[0] + b->getPosition()[1] * b->getPosition()[1] ;
74  // return ( r_a_sqd < r_b_sqd ) ;
75  //fg: try to work around a compiler issue with optimization that leads to seg faults with above code...
76  // needs further investigation
77  return ( a == b ? false :
78  ( a->getPosition()[0] * a->getPosition()[0] + a->getPosition()[1] * a->getPosition()[1] ) <
79  ( b->getPosition()[0] * b->getPosition()[0] + b->getPosition()[1] * b->getPosition()[1] ) ) ;
80  }
81  } ;
82 
84  bool operator()( EVENT::TrackerHit* a, EVENT::TrackerHit* b) const {
85  // double r_a_sqd = a->getPosition()[0] * a->getPosition()[0] + a->getPosition()[1] * a->getPosition()[1] ;
86  // double r_b_sqd = b->getPosition()[0] * b->getPosition()[0] + b->getPosition()[1] * b->getPosition()[1] ;
87  // return ( r_a_sqd < r_b_sqd ) ;
88  //fg: try to work around a compiler issue with optimization that leads to seg faults with above code...
89  // needs further investigation
90  return ( a == b ? false :
91  ( a->getPosition()[0] * a->getPosition()[0] + a->getPosition()[1] * a->getPosition()[1] ) >
92  ( b->getPosition()[0] * b->getPosition()[0] + b->getPosition()[1] * b->getPosition()[1] ) ) ;
93  }
94  } ;
95 
96 
97 
98 
99 protected:
100 
101  UTIL::BitField64* _encoder;
102  int getDetectorID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::subdet]; }
103  int getSideID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::side]; };
104  int getLayerID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::layer]; };
105  int getModuleID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::module]; };
106  int getSensorID(TrackerHit* hit) { _encoder->setValue(hit->getCellID0()); return (*_encoder)[lcio::ILDCellID0::sensor]; };
107 
108 
109  /* helper function to get collection using try catch block */
110  lcio::LCCollection* GetCollection( lcio::LCEvent * evt, std::string colName ) ;
111 
112  double angular_range_2PI( double phi ) const ;
113 
114  void setFTFParameters ( ftf::TrackFindingParameters* para ) ;
115 
116 
120 
124 
128 
132 
133 // /** Input set tracker hit collection name
134 // */
135 // std::string _input_set_hits_col_name ;
136 //
137 // /** Input tpc tracker hit collection name
138 // */
139 // std::string _input_tpc_hits_col_name ;
140 
141 
145 
146 
147  lcio::LCCollection* _input_vxd_hits_col;
148  lcio::LCCollection* _input_sit_hits_col;
149  lcio::LCCollection* _input_ftd_pxl_hits_col;
150  lcio::LCCollection* _input_ftd_spp_hits_col;
151 
152 // lcio::LCCollection* _input_tpc_hits_col;
153 // lcio::LCCollection* _input_set_hits_col;
154 
155  int _n_run ;
156  int _n_evt ;
157 
158  bool _parameter1;
159 
160  ftf::TrackFinder* _trackFinder;
161 
162  std::map<int, TrackerHit*> hitmap;
163 
164  int _nlayers_vxd;
165  int _nlayers_sit;
166  int _nlayers_ftd;
167 
170  MarlinTrk::IMarlinTrkSystem* _trksystem ;
171 
172  bool _MSOn ;
173  bool _ElossOn ;
174  bool _SmoothOn ;
175 
176  float _initialTrackError_d0;
177  float _initialTrackError_phi0;
178  float _initialTrackError_omega;
179  float _initialTrackError_z0;
180  float _initialTrackError_tanL;
181 
182  double _maxChi2PerHit;
183 
184  bool _runMarlinTrkDiagnostics;
185  std::string _MarlinTrkDiagnosticsName;
186 
187  double _Bz;
188 
189  // int _nlayers_tpc;
190 // int _nlayers_set;
191 
192 } ;
193 
194 #endif
195 
196 
197 
virtual void processRunHeader(lcio::LCRunHeader *run)
Called for every run.
Definition: TrackFinderFTF.cc:297
Definition: TrackFinder.h:20
virtual void end()
Called after data processing for clean up.
Definition: TrackFinderFTF.cc:668
virtual void init()
Called at the begin of the job before anything is read.
Definition: TrackFinderFTF.cc:198
Definition: TrackFindingParameters.h:15
MarlinTrk::IMarlinTrkSystem * _trksystem
pointer to the IMarlinTrkSystem instance
Definition: TrackFinderFTF.h:170
std::string _input_ftd_pixel_hits_col_name
Input ftd pixel tracker hit collection name.
Definition: TrackFinderFTF.h:127
std::string _input_sit_hits_col_name
Input sit tracker hit collection name.
Definition: TrackFinderFTF.h:123
Track Finder using FTF processor for marlin.
Definition: TrackFinderFTF.h:40
std::string _input_ftd_spacepoint_hits_col_name
Input ftd spacepoint tracker hit collection name.
Definition: TrackFinderFTF.h:131
std::string _output_track_col_name
Input set tracker hit collection name.
Definition: TrackFinderFTF.h:144
virtual void processEvent(lcio::LCEvent *evt)
Called for every event - the working horse.
Definition: TrackFinderFTF.cc:302
Definition: TrackFinderFTF.h:70
std::string _input_vxd_hits_col_name
Input tpc tracker hit collection name.
Definition: TrackFinderFTF.h:119
Definition: TrackFinderFTF.h:83