MarlinTPC  1.2.0
PhotodotReconstructionProcessor.h
1 #ifdef USE_LCCD
2 
3 #ifndef PHOTODOTRECONSTRUCTIONPROCESSOR_H_
4 #define PHOTODOTRECONSTRUCTIONPROCESSOR_H_ 1
5 
6 //Marlin
7 #include <marlin/Processor.h> // Integral for any processor
8 
9 //gear
10 #include <gear/PadRowLayout2D.h>
11 #include <gearimpl/GlobalPadIndex.h>
12 
13 //lcio
14 #include <IMPL/TrackerPulseImpl.h>
15 
16 //marlinTPC
17 #include "HitCandidate.h"
18 
19 namespace marlintpc
20 {
21 
22 
35 class PhotodotReconstructionProcessor : public marlin::Processor
36 {
37 
38  public: // Functions for interaction with Marlin
39 
42  virtual Processor * newProcessor()
43  {
44  return new PhotodotReconstructionProcessor ;
45  }
46  PhotodotReconstructionProcessor();
47  ~PhotodotReconstructionProcessor();
48 
51  virtual void init();
52 
55  virtual void processRunHeader(lcio::LCRunHeader * run);
56 
59  virtual void processEvent(lcio::LCEvent * evt);
60 
63  virtual void check(lcio::LCEvent * evt);
64 
67  virtual void end();
68 
69  private:
70 
74  struct Photodot
75  {
76  // Cartesian constructor
77  Photodot(double x, double y, double diameter) :
78  _x(x),
79  _y(y),
80  _r(sqrt(x*x + y*y)),
81  _phi(atan2(y, x)),
82  _diameter(diameter) {};
83  // Polar constructor
84  /* The extra integer argument serves simply to differentiate the two
85  * constructor types. Its value is irrelevant.
86  */
87  Photodot(double r, double phi, double diameter, int alt_type) :
88  _x(r * cos(phi)),
89  _y(r * sin(phi)),
90  _r(r),
91  _phi(phi),
92  _diameter(diameter) {};
93  double _x;
94  double _y;
95  double _r;
96  double _phi;
97  double _diameter;
98  };
99 
111  void findNearestHit(Photodot thisPhotodot, int &module, int &pad);
112 
119  int findCentreColumn(int module, int pad);
120 
127  gear::Vector2D findGausHitCentre(int module, int columnCentre);
128 
136  gear::Vector3D findMeanHitCentre(int module, int columnCentre, float* covMatrix);
137 
144  gear::Vector3D calculatePositionsAndErrors(const HitCandidate &cand, float* covMatrix);
151  void findPhotodotPulses(LCCollection* electron_cloud_collection);
152 
159  double getPadCharge(int module, int padIndex);
160 
163  std::string _geometry_filename;
164 
167  std::string _input_pulses_collection_name;
168 
171  std::string _input_hitPosition_collection_name;
172 
176  std::string _output_reconstuctedPhototdots_collection_name;
177 
181  std::string _output_photodot_collection_name;
182 
187  std::vector< Photodot > _photodots;
188  std::vector< Photodot > _expected_photodots;
189 
192  std::multimap<gear::GlobalPadIndex , EVENT::TrackerPulse * > * _pulses;
193 
196  std::string _geometry_type;
197 
200  double _diffusion;
201 
202  /* The following parameters describe the geometry of the TPC
203  */
206  double _omega_tau;
207 
210  double _drift_velocity;
211 
214  double _tpc_outer_radius;
215 
218  double _tpc_inner_radius;
219 
223  double _outer_z;
224 
228  double _inner_z;
229 
230 
233  double _sigma;
234 
238  bool _useGaus;
239 
240 }; // /PhotodotReconstructionProcessor
241 
242 } // /namespace marlintpc
243 
244 #endif //PHOTODOTRECONSTRUCTIONPROCESSOR_H_
245 
246 #endif //USE_LCCD