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 
25 //forward declarations so we can use a reference to these objects here
26 class PndLmdAlignManager;
27 
29 
30 private:
31 
32  friend class PndLmdAlignQA;
33  friend class PndLmdAlignManager;
34 
37  std::string inputFilename;
40 
41  std::vector<std::vector<double> > simplePairs;
42 
44 
45  void printPairSpread(int what = 0);
46  void transformPair(Matrix &trafoMatrix, std::vector<double> &pair);
47  std::vector<double> getPairSpread(int what = 0);
48 
49  bool zeroValCheck();
50 
51  //the manager which contains this SensorAligner
53 
54  //FIXME: in the future, return a TGeoHMatrix
56 
57 public:
58 
61  virtual ~PndLmdSensorAligner();
62 
63  //every constructor should call this, also resets aligner (even though that never happens in normal use)
64  void init();
65 
66  // add simplified pair, for size and performance reasons, return false if aligner has enough pairs, return true if successful
67  bool addSimplePair(const PndLmdHitPair &pair);
68 
69  //TODO: these two functions belong in the manager, not the aligner
70  bool writePairsToBinary(const std::string directory);
71  bool readPairsFromBinary(const std::string directory);
72 
73  //set how many pairs the aligner should use, if higher than available in file, it will use all available
74  //set 0 for all
75  void setMaximumNumberOfHitPairs(Int_t maxPairs) {
76  if (maxPairs > 0) {
77  maxNoOfPairs = maxPairs;
78  simplePairs.reserve(maxPairs);
79  }
80  }
81 
84 
85  bool check();
86 
87  void clearPairs();
88 
89  //deactivate iterative part
90  void setForceInstant(Bool_t instant) {
91  forceInstant = instant;
92  }
93 
94  void setModuleID(Int_t ID) {
95  _moduleID = ID;
96  }
97  int getModuleID() {
98  return _moduleID;
99  }
100  int getNoOfPairs() {
101  // usually, simplePairs contains all pairs, but if it gets cleared,
102  // the info is lost, so we save the number of pairs somewhere else.
103  int sPairs = simplePairs.size();
104  if (sPairs > 0) {
105  return sPairs;
106  }
107  else {
108  return lastNoOfPairs;
109  }
110  }
111 
112  void applyDynamicCut(double percent=5.0);
113 
114  void calculateMatrix();
115 
116  int getOverlapId() const {
117  return overlapID;
118  }
119 
120  void setOverlapId(Int_t overlapId) {
121  overlapID = overlapId;
122  }
123 
124  const Matrix& getResultMatrix() const {
125  return resultMatrix;
126  }
127 
128  //true in cm, false in pixels
129  void setInCentimeters(bool value) {
130  inCentimeters = value;
131  }
132 
133  bool successful() {
134  return success;
135  }
136 
137  void setZasTimetamp(bool value) {
138  zIsTimestamp = value;
139  }
140 
141  void verboseLevel(int level) {
142  verbose = level;
143  }
144 
146  superManager = manager;
147  }
148 
149  unsigned int getDim() const {
150  return dim;
151  }
152 
153  void setDim(unsigned int value) {
154  dim = value;
155  }
156 };
157 
158 #endif /* LMD_LMDSENSORALIGNMENT_PNDLMDSENSORALIGNER_H_ */
bool writePairsToBinary(const std::string directory)
std::vector< std::vector< double > > simplePairs
unsigned int getDim() const
void transformPair(Matrix &trafoMatrix, std::vector< double > &pair)
void verboseLevel(int level)
void setModuleID(Int_t ID)
void setOverlapId(Int_t overlapId)
bool addSimplePair(const PndLmdHitPair &pair)
void setMaximumNumberOfHitPairs(Int_t maxPairs)
void applyDynamicCut(double percent=5.0)
std::vector< double > getPairSpread(int what=0)
void setInCentimeters(bool value)
void setDim(unsigned int value)
void setZasTimetamp(bool value)
void setManager(PndLmdAlignManager *manager)
Definition: matrix.h:50
PndLmdAlignManager * superManager
void setForceInstant(Bool_t instant)
TString directory
void printPairSpread(int what=0)
const Matrix & getResultMatrix() const
bool readPairsFromBinary(const std::string directory)