MarlinTrkProcessors  2.4.1
ExtrToTracker.h
1 #ifndef ExtrToTracker_h
2 #define ExtrToTracker_h 1
3 
4 #include <marlin/Processor.h>
5 #include <string>
6 #include <iostream>
7 #include <algorithm>
8 #include <vector>
9 #include <cmath>
10 #include <time.h>
11 #include <math.h>
12 #include <sstream>
13 #include <assert.h>
14 
15 #include <UTIL/LCRelationNavigator.h>
16 #include <UTIL/BitField64.h>
17 #include <UTIL/ILDConf.h>
18 #include <UTIL/BitSet32.h>
19 
20 #include <EVENT/TrackerHit.h>
21 #include <EVENT/SimTrackerHit.h>
22 #include <EVENT/TrackerHitPlane.h>
23 #include <IMPL/TrackerHitImpl.h>
24 #include <EVENT/LCCollection.h>
25 #include <EVENT/LCRelation.h>
26 #include <IMPL/LCCollectionVec.h>
27 #include <IMPL/LCFlagImpl.h>
28 #include <IMPL/LCRelationImpl.h>
29 #include <EVENT/Track.h>
30 #include <IMPL/TrackStateImpl.h>
31 #include <IMPL/TrackImpl.h>
32 
33 #include "KiTrack/SubsetHopfieldNN.h"
34 #include "KiTrack/SubsetSimple.h"
35 
36 #include "marlin/Global.h"
37 
38 //---- GEAR ----
39 /* #include "gear/GEAR.h" */
40 /* #include <gear/ZPlanarParameters.h> */
41 /* #include <gear/ZPlanarLayerLayout.h> */
42 /* #include "gear/BField.h" */
43 
44 #include "DDRec/Surface.h"
45 #include "DDRec/SurfaceManager.h"
46 
47 
48 // ----- include for verbosity dependend logging ---------
49 #include "marlin/VerbosityLevels.h"
50 
51 #include "MarlinTrk/Factory.h"
52 #include "MarlinTrk/IMarlinTrack.h"
53 #include "MarlinTrk/MarlinTrkUtils.h"
54 #include "MarlinTrk/HelixTrack.h"
55 
56 
57 
58 
59 
60 
61 using namespace KiTrack;
62 namespace MarlinTrk{
63  class IMarlinTrkSystem ;
64 }
65 
66 
67 class ExtrToTracker : public marlin::Processor {
68 
69 
70 public:
71 
72 
73  virtual marlin::Processor* newProcessor() { return new ExtrToTracker ; }
74 
75  ExtrToTracker() ;
76 
80  virtual void init() ;
81 
84  virtual void processRunHeader( lcio::LCRunHeader* run ) ;
85 
88  virtual void processEvent( lcio::LCEvent * evt ) ;
89 
90 
91  virtual void check( lcio::LCEvent * evt ) ;
92 
93 
96  virtual void end() ;
97 
98  int FitInit2( Track* track , MarlinTrk::IMarlinTrack* _marlinTrk ) ;
99 
100  struct compare_r {
101  bool operator()( EVENT::TrackerHit* a, EVENT::TrackerHit* b) const {
102  double r_a_sqd = a->getPosition()[0] * a->getPosition()[0] + a->getPosition()[1] * a->getPosition()[1] ;
103  double r_b_sqd = b->getPosition()[0] * b->getPosition()[0] + b->getPosition()[1] * b->getPosition()[1] ;
104  return ( r_a_sqd < r_b_sqd ) ;
105  }
106  } ;
107 
108 
109 
110  //TrackerHitPlane* getSiHit(LCCollection*& sitHitsCol, int fitElID, MarlinTrk::IMarlinTrack*& marlin_trk, int& nHitsOnDetEl);
111  //TrackerHit* getSiHit(LCCollection*& sitHitsCol, int fitElID, MarlinTrk::IMarlinTrack*& marlin_trk, int& nHitsOnDetEl);
112  //bool getSiHit(LCCollection*& sitHitsCol, int fitElID, MarlinTrk::IMarlinTrack*& marlin_trk, TrackerHit*& selectedHit);
113 
114 
115  TrackerHitPlane* getSiHit(std::vector<TrackerHitPlane* >& hitsOnDetEl, MarlinTrk::IMarlinTrack*& marlin_trk);
116 
117  TrackerHitPlane* getSiHit(std::vector<int >& vecElID, std::map<int , std::vector<TrackerHitPlane* > >& mapElHits, MarlinTrk::IMarlinTrack*& marlin_trk);
118 
119  void getNeighbours(int elID, std::vector<int >& vecIDs, std::string cellIDEcoding, std::map<int , int > mapLayerNModules);
120 
121 
122  void fillMapElHits(std::vector<LCCollection* >& vecHitCol, std::vector<std::map<int , std::vector<TrackerHitPlane* > > >& vecMaps);
123 
124 
125  /* void addHitOnNextElID(int elementID, MarlinTrk::IMarlinTrack*& marlin_trk, EVENT::TrackerHitVec& trkHits, LCCollection*& sitHitsCol, LCCollection*& otHitsCol, int& iL, int& nSITR, int& TotalSITHits, int& SITHitsPerTrk, int& SITHitsFitted, int& SITHitsNonFitted); */
126 
127 
128  void fillVecSubdet(lcio::LCEvent*& evt);
129 
130  void getGeoInfo();
131 
132 
133 
134 protected:
135 
136  /* helper function to get collection using try catch block */
137  lcio::LCCollection* GetCollection( lcio::LCEvent * evt, std::string colName ) ;
138 
139  /* /\* helper function to get relations using try catch block *\/ */
140  /* lcio::LCRelationNavigator* GetRelations(lcio::LCEvent * evt, std::string RelName ) ; */
141 
144  std::string _input_track_col_name ;
145 
146 
150 
154 
158 
161  MarlinTrk::IMarlinTrkSystem* _trksystem ;
162 
163  /* std::string _mcParticleCollectionName ; */
164 
165  bool _MSOn ;
166  bool _ElossOn ;
167  bool _SmoothOn ;
168  double _Max_Chi2_Incr ;
169  double _searchSigma ;
170 
171  int _n_run ;
172  int _n_evt ;
173  int SITHitsFitted ;
174  int SITHitsNonFitted ;
175  int TotalSITHits ;
176  int _nHitsChi2 ;
177 
178  float _maxChi2PerHit;
179  float _bField;
180 
181  bool _performFinalRefit ;
182 
183 
184  const DD4hep::DDRec::SurfaceMap* _map ;
185 
186 
187 
188  //processor parameters
189 
190  StringVec _vecDigiHits;
191  StringVec _vecSubdetName;
192  std::vector<int > _vecSubdetNLayers;
193  std::vector<int > _vecSubdetID;
194  std::vector<LCCollection* > _vecDigiHitsCol;
195  std::vector<std::map<int , int > > _vecMapLayerNModules;
196 
197  std::vector<std::map<int , std::vector<TrackerHitPlane* > > > _vecMapsElHits;
198 
199 
200 } ;
201 
202 
203 
204 
205 
206 #endif
207 
208 
209 
std::string _output_track_col_name
output track collection name.
Definition: ExtrToTracker.h:153
std::string _input_track_col_name
Input track collection name for refitting.
Definition: ExtrToTracker.h:144
std::string _output_track_rel_name
Output track relations name for refitting.
Definition: ExtrToTracker.h:157
std::string _output_not_used_col_name
output collection name for the not used hits.
Definition: ExtrToTracker.h:149
Definition: ExtrToTracker.h:100
MarlinTrk::IMarlinTrkSystem * _trksystem
pointer to the IMarlinTrkSystem instance
Definition: ExtrToTracker.h:161
Definition: ExtrToTracker.h:67