MarlinTPC  1.2.0
PhotoelectricDistortionsCalculator.h
1 #ifndef PHOTOELECTRICDISTORTIONSCALCULATOR_H_
2 #define PHOTOELECTRICDISTORTIONSCALCULATOR_H_
3 
4 // C++
5 #include <vector>
6 
7 // CLHEP
8 #include <CLHEP/Vector/TwoVector.h>
9 
10 // MarlinTPC
11 #include "TPCDistortionMeasurement.h"
12 
13 // GEAR
14 #include "gear/TPCModule.h"
15 
16 namespace marlintpc {
17 struct Element2D{
18  gear::Vector2D p[4];
19  gear::Vector2D shift[4];
20 };
21 
44 public:
45  /* The constructor takes the distortions information and fills it into an internal map.
46  * If fastSearch is true the information is stored per module else it is stored in a single vector.
47  * Later only dots from a single module are used in case of no module interpolation is used.
48  * Thus the search is faster, but at the boundaries of the module the shift can not be calculated,
49  * since for an element at the boundary also a dot from a neighboring module is needed.
50  * \remark Use the module interpolation only if there are no field distortions at the module boundary.
51  * Else the resulting distortions at the module boundary are wrong!
52  */
53  PhotoelectricDistortionsCalculator(const std::vector<tpcconddata::TPCDistortionMeasurement*> &map, bool moduleInterpolation = false);
54  /* Calculates the estimated shift to move the given point to the estimated point without distortions.
55  * Give the measured point in global coordinates.
56  * \remark This shift is given in local coordinates c0, c1 of the module!
57  */
58  gear::Vector2D getEstimatedShift2D(const CLHEP::Hep3Vector &measuredPosition);
59 
60  /* Set the maximum distance from a corner of the constructed element to the given measured point.
61  */
62  void setMaxDistance(double dist){_maxDist = dist;}
63 
64 private:
65  /* Map containing the module id and vector of photodot distortions.
66  * The module id is taken from the reconstructed photodot position.
67  */
68  std::map<int,std::vector<tpcconddata::TPCDistortionMeasurement*> > _tpcDistortionsMap;
69 
70  Element2D _element;
71 
72  int _module;
73 
74  double _maxDist;
75 
76  gear::Vector2D _point;
77 
78  bool _moduleInterpolation;
79 
80  /* Construct the element to be used to calculate field distortions.
81  * Find top left/right and bottom left/right photodot with respect to a given position.
82  * \return True if 4 corners were found.
83  */
84  bool constructElement();
85  /* After the element is found now inside the element the shift is calculated.
86  */
87  gear::Vector2D calculateEstimatedShift();
88 
89  /* Here the measured point in local coordinates of the module is converted into
90  * the coordinates of the isoparametric element.
91  */
92  gear::Vector2D getElementCoordinates();
93 };
94 }
95 
96 
97 
98 #endif /* PHOTOELECTRICDISTORTIONSCALCULATOR_H_ */
Definition: PhotoelectricDistortionsCalculator.h:17
Definition: PhotoelectricDistortionsCalculator.h:43