FairRoot/PandaRoot
PndLmdSensorAligner.h
Go to the documentation of this file.
1 /*
2  * PndLmdSensorAligner.h
3  *
4  * Created on: May 6, 2015
5  * Author: Roman Klasen, roklasen@uni-mainz.de or klasen@kph.uni-mainz.de
6  *
7  * This class gets HitPairs from PndLmdAlignManager and generates transformation matrices for ONE overlapping area.
8  * It works in cm and gives the matrix between sensors, so the hit pairs MUST have valid x, y and z coordinates
9  * in cm.
10  *
11  * One SensorAligner is responsible for one overlapping area alone, so 360 aligners are needed for the entire detector.
12  * Therefore, only the PndLmdAlignManager should interact with this class.
13  */
14 
15 #ifndef LMD_LMDSENSORALIGNMENT_PNDLMDSENSORALIGNER_H_
16 #define LMD_LMDSENSORALIGNMENT_PNDLMDSENSORALIGNER_H_
17 
18 #include "PndLmdHitPair.h"
19 
20 #include <string>
21 #include <vector>
22 
23 #include <matrix.h>
24 
26 
27 private:
28 
29  friend class PndLmdAlignQA;
30 
33  std::string _inputFilename;
36 
39 
41 
43 
44 public:
45 
48  virtual ~PndLmdSensorAligner();
49 
50  //every constructor should call this, also resets aligner (even though that never happens in normal use)
51  void init();
52 
53  // add simplified pair, for size and performance reasons, return false if aligner has enough pairs, return true if successful
54  bool addSimplePair(const PndLmdHitPair &pair);
55 
56  bool writePairsToBinary(const std::string directory);
57  bool readPairsFromBinary(const std::string directory);
58 
59  //set how many pairs the aligner should use, if higher than available in file, it will use all available
60  void setMaximumNumberOfHitPairs(Int_t maxPais) {
61  if (maxPais > 0) {
62  _maxNoOfPairs = maxPais;
63 
64  //check vector capacity to avoid constant re-allocation, use max pairs
65  simpleSensorOneX.reserve(maxPais);
66  simpleSensorOneY.reserve(maxPais);
67  simpleSensorOneZ.reserve(maxPais);
68  simpleSensorTwoX.reserve(maxPais);
69  simpleSensorTwoY.reserve(maxPais);
70  simpleSensorTwoZ.reserve(maxPais);
71  }
72  }
73 
74  void clearPairs();
75 
76  //deactivate iterative part, use for debug only
77  void setForceInstant(Bool_t instant) {
78  forceInstant = instant;
79  }
80 
81  void setModuleID(Int_t ID) {
82  _moduleID = ID;
83  }
84  int getModuleID() {
85  return _moduleID;
86  }
87  int getNoOfPairs() {
88  return std::max(simpleSensorOneX.size(), (size_t) lastNoOfPairs);
89  }
90 
91  void calculateMatrix();
92 
93  int getOverlapId() const {
94  return overlapID;
95  }
96 
97  void setOverlapId(Int_t overlapId) {
98  overlapID = overlapId;
99  }
100 
101  const Matrix& getResultMatrix() const {
102  return resultMatrix;
103  }
104 
105  //true in cm, false in pixels
106  void setInCentimeters(bool inCentimeters) {
107  _inCentimeters = inCentimeters;
108  }
109 
110  bool successful() {
111  return _success;
112  }
113 
114  void setZasTimetamp(bool value) {
115  _zIsTimestamp = value;
116  }
117 
118  void verboseLevel(int level) {
119  verbose = level;
120  }
121 };
122 
123 #endif /* LMD_LMDSENSORALIGNMENT_PNDLMDSENSORALIGNER_H_ */
std::vector< double > simpleSensorTwoZ
std::vector< double > simpleSensorOneX
void setInCentimeters(bool inCentimeters)
bool writePairsToBinary(const std::string directory)
void verboseLevel(int level)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
void setModuleID(Int_t ID)
void setOverlapId(Int_t overlapId)
bool addSimplePair(const PndLmdHitPair &pair)
void setMaximumNumberOfHitPairs(Int_t maxPais)
std::vector< double > simpleSensorTwoY
std::vector< double > simpleSensorOneY
std::vector< double > simpleSensorOneZ
void setZasTimetamp(bool value)
Definition: matrix.h:50
void setForceInstant(Bool_t instant)
std::vector< double > simpleSensorTwoX
TString directory
const Matrix & getResultMatrix() const
bool readPairsFromBinary(const std::string directory)