MarlinTPC  1.2.0
TimePixHoughTransformNormalProcessor.h
1 #ifndef TIMEPIXHOUGHTRANSFORMIMPROCESSOR_H
2 #define TIMEPIXHOUGHTRANSFORMIMPROCESSOR_H
3 
4 #include <marlin/Processor.h>
5 #include <lcio.h>
6 
7 // CPP
8 #include <string>
9 #include <cmath>
10 #include <iostream>
11 #include <vector>
12 #include <algorithm>
13 
14 // ROOT
15 #include "TH2D.h"
16 #include "TFile.h"
17 
18 // LCIO
19 #include <gear/PadRowLayout2D.h>
20 #include <EVENT/LCEvent.h>
21 #include <IMPL/LCCollectionVec.h>
22 #include <IMPL/TrackImpl.h>
23 #include <IMPL/LCFlagImpl.h>
24 #include <EVENT/TrackerHit.h>
25 #include <Exceptions.h>
26 
27 #include "TrackFitterFactory.h"
28 #include "TrackFitterBase.h"
29 
30 using namespace lcio;
31 using namespace marlin;
32 using namespace std;
33 
34 
35 namespace marlintpc
36 {
52 class TimePixHoughTransformNormalProcessor : public marlin::Processor
53 {
54  public:
55 
56  virtual Processor* newProcessor() { return new TimePixHoughTransformNormalProcessor; }
57 
59 
60  virtual void init();
61 
62  virtual void processRunHeader(lcio::LCRunHeader* run);
63 
64  virtual void processEvent(lcio::LCEvent* evt);
65 
66  virtual void check(lcio::LCEvent* evt);
67 
68  virtual void end();
69 
70  /* typedefs */
71  typedef std::vector< TrackImpl * > TrackImplVec;
72 
73  /* my functions */
77  virtual void FillHistogram();
81  virtual void GetTrackProperties();
85  virtual void CreateTracks();
90  virtual void AddHits();
94  virtual void RemoveSparseTracks( TrackImplVec & ImplVec, TrackImplVec::iterator itFirst, TrackImplVec::iterator itLast );
98  virtual void OutputAddElement( LCCollectionVec *& outputCol, TrackImplVec::iterator itFirst, TrackImplVec::iterator itLast );
99 
102  {
103  double _Phi;
104  double _D0;
106 
107  TrackProperties( double phivalue = 0, double d0value = 0
108  , int hitsontrackvalue = 0)
109  {
110  _Phi = phivalue;
111  _D0 = d0value;
112  _hitsontrack = hitsontrackvalue;
113  };
114 
115  bool operator <( TrackProperties const trackproperties ) const
116  {
117  return (_hitsontrack < trackproperties._hitsontrack);
118  }
119 
120  bool operator >( TrackProperties const trackproperties ) const
121  {
122  return (_hitsontrack > trackproperties._hitsontrack);
123  }
124 
125  bool operator == ( TrackProperties const trackproperties ) const
126  {
127  return( _D0 == trackproperties._D0
128  && _Phi == trackproperties._Phi
129  && _hitsontrack == trackproperties._hitsontrack
130  );
131  }
132  };
133 
134  static bool sortPredicate(const TrackProperties& lhs, const TrackProperties& rhs)
135  {
136  // locate largest as first element
137  return lhs._hitsontrack > rhs._hitsontrack;
138  }
139 
140  static bool sortTrackImpl( const TrackImpl * lhs, const TrackImpl * rhs )
141  {
142  // locate largest as first element
143  return lhs->getTrackerHits().size() > rhs->getTrackerHits().size();
144  }
145 
146  protected:
147  TH1D * _hMaxConvoluted;
148 
149  /* the place for protected and private member data and functions */
150  std::string _inputColName;
151  std::string _outputColName;
152 
153  LCCollectionVec * _inputColVec;
154 
155  /* parameters: Track */
157  int _ChipID;
159  TrackerHitVec _hitVec;
160 
161  /* containers */
162  std::vector< TrackProperties > _trackPropertiesY;
163  TrackImplVec _trackImplsY;
164 
166  std::vector< TH2D * > _histoHoughSpaceVec;
167 
168  /* parameters: Hough space XY*/
174 
175  /* */
176  std::string _fileName;
177  int _MaxHisto;
178  int _CurrentHisto;
179 
184 
185 };
186 } // namespace marlintpc
187 #endif // HOUGHTRAFOIMPROCESSOR_H
TrackerHitVec _hitVec
store TRackerHits from _inputColVec
Definition: TimePixHoughTransformNormalProcessor.h:159
std::string _inputColName
Name of the input collection.
Definition: TimePixHoughTransformNormalProcessor.h:150
double _maxDistanceToTrackY
Maximum distance of a hit to the track in mm in the xy plane.
Definition: TimePixHoughTransformNormalProcessor.h:158
float _houghSpaceMinPhi
The half range (HoughSpaceMinPhi .. HoughSpaceMaxPhi) of the Hough space histogram in 'phi' direction...
Definition: TimePixHoughTransformNormalProcessor.h:171
double _D0
impact parameter of the track in the x-y-plane (defines the Point of closest approach, PCA)
Definition: TimePixHoughTransformNormalProcessor.h:104
std::string _outputColName
Name of the output collection.
Definition: TimePixHoughTransformNormalProcessor.h:151
std::string _fileName
Histograms will be written to this file.
Definition: TimePixHoughTransformNormalProcessor.h:176
Take an inputCollection of TrackerHits, treat those TrackerHits in groups (based on their CellID1(cih...
Definition: TimePixHoughTransformNormalProcessor.h:52
double _Phi
angle between the track and the x-axis in the x-y-projection
Definition: TimePixHoughTransformNormalProcessor.h:103
int _houghSpaceNBinsD0
The number of bins in the hough space histogram in 'D0' direction (default 50)
Definition: TimePixHoughTransformNormalProcessor.h:172
std::vector< TH2D * > _histoHoughSpaceVec
vector of Hough space histograms
Definition: TimePixHoughTransformNormalProcessor.h:166
int _hitsontrack
number of hits on the track
Definition: TimePixHoughTransformNormalProcessor.h:105
nested helper class that stores the properties of a straight track
Definition: TimePixHoughTransformNormalProcessor.h:101
int _outputIsTransient
< Number of the current Histogram
Definition: TimePixHoughTransformNormalProcessor.h:183
std::vector< TrackProperties > _trackPropertiesY
storing track properties for xy plane
Definition: TimePixHoughTransformNormalProcessor.h:162
float _houghSpaceMaxD0
The half range (-max..max) of the Hough space histogram in 'D0' direction (default 65) ...
Definition: TimePixHoughTransformNormalProcessor.h:173
float _houghSpaceMaxPhi
The half range (HoughSpaceMinPhi .. HoughSpaceMaxPhi) of the Hough space histogram in 'phi' direction...
Definition: TimePixHoughTransformNormalProcessor.h:170
int _houghSpaceNBinsPhi
The number of bins in the hough space histogram in 'phi' direction (default 100)
Definition: TimePixHoughTransformNormalProcessor.h:169
int _nHitsOnTrack
minimum number if hits on track
Definition: TimePixHoughTransformNormalProcessor.h:156
TrackImplVec _trackImplsY
storing in xy plane found tracks
Definition: TimePixHoughTransformNormalProcessor.h:163
TH2D * _histoHoughSpace
one Hough space histogram
Definition: TimePixHoughTransformNormalProcessor.h:165
int _MaxHisto
Maximum number of saved Histograms.
Definition: TimePixHoughTransformNormalProcessor.h:177
int _ChipID
only the chip with _ChipID (CellID1) will be processed; if set to -1 all chipIDs will be processed ...
Definition: TimePixHoughTransformNormalProcessor.h:157