MyMarlinTPC  170316
RowBasedHitFinderProcessor.h
Go to the documentation of this file.
1 #ifndef ROWBASEDHITFINDERPROCESSOR_H
2 #define ROWBASEDHITFINDERPROCESSOR_H
3 
4 // MARLIN
5 #include "marlin/Processor.h"
6 #include "marlin/Global.h"
7 
8 //LCIO
9 #include "lcio.h"
10 #include "EVENT/LCCollection.h"
11 #include "IMPL/LCCollectionVec.h"
12 #include "EVENT/TrackerPulse.h"
13 
14 //GEAR
15 #include "gear/TPCParameters.h"
16 
17 // C++
18 #include <string>
19 #include <vector>
20 #include <map>
21 
22 // MARLINTPC
23 #include "ChannelCorrectionListener.h"
24 #include "TPCConditionsListener.h"
25 
26 namespace marlintpc
27 {
28 
70  class RowBasedHitFinderProcessor : public marlin::Processor
71  {
72  public:
73 
74  virtual Processor* newProcessor()
75  {
76  return new RowBasedHitFinderProcessor;
77  }
78 
80 
84  virtual void init() ;
85 
88  virtual void processRunHeader(lcio::LCRunHeader* run) ;
89 
92  virtual void processEvent(lcio::LCEvent * evt) ;
93 
94 
95  virtual void check(lcio::LCEvent * evt) ;
96 
97 
100  virtual void end() ;
101 
102  private:
106 
110 
114 
117 
123  std::vector<int> _deadChannelIndicesOverride;
124 
128 
132 
136 
140 
144 
148 
152 
156 
160 
164 
167  ChannelCorrectionListener* _channelCorrectionListener;
168 
171  TPCConditionsListener* _tpcConditionsListener;
172 
173  // a helper class -- does it make sense to externalise it from the HitFinder?
175  {
176  public:
177  hitCandidate(EVENT::TrackerPulse*);
178 
179  void addPulse(EVENT::TrackerPulse*);
180  void addDeadChannel();
181 
183 
184  const EVENT::TrackerPulse* getMaximumPulse() const
185  {
186  return _maxPulse;
187  };
188  double getCharge() const;
189  double getChargeMeasError() const;
190  double getMaxPulseHeight();
191  const std::vector<EVENT::TrackerPulse*>& getPulses() const
192  {
193  return _thePulses;
194  };
195  unsigned int getWidth() const;
196 
197  private:
199  {
200  ;
201  };
202  std::vector<EVENT::TrackerPulse*> _thePulses;
203  EVENT::TrackerPulse* _maxPulse;
206  };
207 
210  void _sortPulses(EVENT::LCCollection*, const gear::TPCParameters&,
211  std::map<int, std::map<int, std::vector<EVENT::TrackerPulse*>* >* >&);
212  void _findHitCandidates(std::map<int, std::map<int, std::vector<EVENT::TrackerPulse*>* >* >&,
213  const gear::TPCParameters&,
214  std::map<int, std::vector<RowBasedHitFinderProcessor::hitCandidate> >&);
215  void _createHitCollection(std::map<int, std::vector<RowBasedHitFinderProcessor::hitCandidate> >&,
216  const gear::TPCParameters&, IMPL::LCCollectionVec*);
217 
218  bool _pulseComparator(EVENT::TrackerPulse*, EVENT::TrackerPulse*);
219  EVENT::TrackerPulse* _findHighestPulseInRow(std::vector<EVENT::TrackerPulse*>&);
220  bool _maxPulseHeightCheck(EVENT::TrackerPulse*);
221  void _addNeighbourPulses(hitCandidate&, const gear::TPCParameters&, std::vector<EVENT::TrackerPulse*>&);
222  std::vector<EVENT::TrackerPulse*>::iterator _findBestNeighbourPulseMatch
223  (std::vector<std::vector<EVENT::TrackerPulse*>::iterator>&, float);
224 
226  gear::Vector3D _calculatePositionsAndErrors(const RowBasedHitFinderProcessor::hitCandidate&, const gear::TPCParameters&, float*);
228 
229  unsigned int _getMaxDeadChannels();
230  int _getMinHitSize();
232  double _getMaxTimeSpread();
233  double _getDriftVelocity();
234  bool _padIsDead(const int, const int);
235  bool _padIsNoisy(const int, const int);
237 
238  };
239 }//namespace marlintpc
240 #endif//ROWBASEDHITFINDERPROCESSOR_H
void _createHitCollection(std::map< int, std::vector< RowBasedHitFinderProcessor::hitCandidate > > &, const gear::TPCParameters &, IMPL::LCCollectionVec *)
void _addNeighbourPulses(hitCandidate &, const gear::TPCParameters &, std::vector< EVENT::TrackerPulse *> &)
void _findHitCandidates(std::map< int, std::map< int, std::vector< EVENT::TrackerPulse *> * > * > &, const gear::TPCParameters &, std::map< int, std::vector< RowBasedHitFinderProcessor::hitCandidate > > &)
EVENT::TrackerPulse * _findHighestPulseInRow(std::vector< EVENT::TrackerPulse *> &)
double _convertCharge(const RowBasedHitFinderProcessor::hitCandidate &)
std::vector< EVENT::TrackerPulse * >::iterator _findBestNeighbourPulseMatch(std::vector< std::vector< EVENT::TrackerPulse *>::iterator > &, float)
void _sortPulses(EVENT::LCCollection *, const gear::TPCParameters &, std::map< int, std::map< int, std::vector< EVENT::TrackerPulse *> * > * > &)
virtual void processRunHeader(lcio::LCRunHeader *run)
bool _hitIsValid(const RowBasedHitFinderProcessor::hitCandidate &)
ChannelCorrectionListener * _channelCorrectionListener
const std::vector< EVENT::TrackerPulse * > & getPulses() const
bool _pulseComparator(EVENT::TrackerPulse *, EVENT::TrackerPulse *)
gear::Vector3D _calculatePositionsAndErrors(const RowBasedHitFinderProcessor::hitCandidate &, const gear::TPCParameters &, float *)
virtual void processEvent(lcio::LCEvent *evt)