CbmRoot
CbmRichRonchiAna.h
Go to the documentation of this file.
1 #ifndef RICH_MIRRORS_CBMRICHRONCHIANA_H_
2 #define RICH_MIRRORS_CBMRICHRONCHIANA_H_
3 
4 #include "TObject.h"
5 #include "TVector3.h"
6 #include <cmath>
7 #include <string>
8 #include <vector>
9 
10 using namespace std;
11 
12 class TH2;
13 
15 public:
17  : fPixelX(0)
18  , fPixelY(0)
19  , fLineX(0)
20  , fLineY(0)
21  , fNormalRadX(0.)
22  , fNormalRadY(0.)
23  , fOrderedLineX(0)
24  , fOrderedLineY(0)
25  , fCcdV()
26  , fRulingV()
27  , fMirrorV()
28  ,
29 
30  fTL()
31  , fTR()
32  , fBL()
33  , fBR()
34  ,
35 
36  fTLRot()
37  , fTRRot()
38  , fBLRot()
39  , fBRRot()
40  ,
41 
42  fTLSph()
43  , fTRSph()
44  , fBLSph()
45  , fBRSph()
46  ,
47 
48  fDeviation(0.)
49  , fRLoc(0.) {}
50 
51  int fPixelX;
52  int fPixelY;
53  int fLineX;
54  int fLineY;
55 
56  double fNormalRadX; // Normal X in radians
57  double fNormalRadY;
58 
61 
62  TVector3 fCcdV; // XYZ positions CCD in microns
63  TVector3 fRulingV; // XYZ positions ronchi ruling in microns
64  TVector3 fMirrorV; // XYZ positions of mirror in microns
65 
66  TVector3 fTL; // corners of segment BEFORE rotation
67  TVector3 fTR;
68  TVector3 fBL;
69  TVector3 fBR;
70 
71  TVector3 fTLRot; // corners of segment AFTER rotation
72  TVector3 fTRRot;
73  TVector3 fBLRot;
74  TVector3 fBRRot;
75 
76  TVector3 fTLSph; // corners of segment after 'DoSphere'
77  TVector3 fTRSph;
78  TVector3 fBLSph;
79  TVector3 fBRSph;
80 
81 
82  std::vector<double>
83  fVecTL; // vectors that point from center of a segment to the corners (for calculation of rotations) --CAN BE DELETED!?
84  std::vector<double> fVecTR;
85  std::vector<double> fVecBL;
86  std::vector<double> fVecBR;
87 
88  double fDeviation;
89  double fRLoc;
90 };
91 
93 public:
95  : fNofPoints(0), fMeanPrimary(0), fMeanSecondary(0), fLineInd(0) {}
96 
98  double fMeanPrimary;
100  int fLineInd;
101 };
102 
103 class CbmRichRonchiAna : public TObject {
104 public:
106 
107  virtual ~CbmRichRonchiAna();
108 
109  void Run();
110 
111  void SetTiffFileNameV(const string& fileName) { fTiffFileNameV = fileName; }
112  void SetTiffFileNameH(const string& fileName) { fTiffFileNameH = fileName; }
113 
114 private:
117 
118  // constant values
119  double fPi;
120  double fRadiusMirror; // in microns
121  double fEdgeLengthCCD; // in microns
122  double fCcdPixelSize; // in microns
123  double fPitchGrid; // in microns; distance of lines
124  double fImageWidth; // in pixels
125 
126  // values to be measured first
127  double fDistRulingCCD; // in microns
128  double fDistMirrorCCD; // in microns
130  double
131  fOffsetCCDOptAxisX; // in microns; horizontal distance of center of CCD to optical axis of mirror
132  double
133  fOffsetCCDOptAxisY; // in microns; vertical distance of center of CCD to optical axis of mirror
134  double
135  fOffsetLEDOpticalAxisX; // in microns; horizontal distance of light source to optical axis of mirror
137  double
138  fCorrection; // correction value; defines center of mirror at exactly 3,000,000 mum in z dircetion
139 
140  // values that will be determined by function
141  double
142  fCenterCcdX; // in pixels; approximate center of image on CCD, will be defined in 'DoLocalNormal' function
143  double fCenterCcdY; // in pixels
144  double
145  fImageCenterMirrorX; // in pixels; approximate center of image on mirror (NEEDED??)
146  double fImageCenterMirrorY; // in pixels
147 
148  vector<vector<double>> ReadTiffFile(const string& fileName);
149 
150  void DoRotation(vector<vector<double>>& data);
151 
152  void FillH2WithVector(TH2* hist, const vector<vector<double>>& data);
153 
154  void DoMeanIntensityY(vector<vector<double>>& data);
155 
156  void DoPeakFinderY(vector<vector<double>>& data);
157 
158  void DoSmoothLines(vector<vector<double>>& data);
159 
160  void DoLineSearch(vector<vector<double>>& data);
161 
162  vector<vector<double>> DoSuperpose(const vector<vector<double>>& dataH,
163  const vector<vector<double>>& dataV);
164 
165  vector<CbmRichRonchiIntersectionData>
166  DoIntersection(vector<vector<double>>& dataH,
167  const vector<vector<double>>& dataV);
168 
169  void DoOrderLines(vector<CbmRichRonchiIntersectionData>& intersections,
170  const string& option);
171  bool AreTwoSegmentsSameLine(const CbmRichRonchiLineData* line1,
172  const CbmRichRonchiLineData* line2);
173  void UpdateIntersectionLineInd(
174  vector<CbmRichRonchiIntersectionData>& intersections,
175  CbmRichRonchiLineData* line1,
176  CbmRichRonchiLineData* line2,
177  const string& option);
178 
179  void DoLocalNormal(vector<CbmRichRonchiIntersectionData>& data);
180  void DrawXYMum(vector<CbmRichRonchiIntersectionData>& data);
181  void DrawXZProjection(vector<CbmRichRonchiIntersectionData>& data,
182  int orderedLineY,
183  double scale);
184  void DrawMirrorSegments(vector<CbmRichRonchiIntersectionData>& data,
185  int orderedLineX,
186  int orderedLineY);
187  void DrawMirrorSegmentsSphereAll(vector<CbmRichRonchiIntersectionData>& data);
188  void DrawMirrorSegmentsSphere(vector<CbmRichRonchiIntersectionData>& data,
189  int orderedLineX,
190  int orderedLineY);
191  void DrawOneMirrorSegment(const TVector3& tl,
192  const TVector3& tr,
193  const TVector3& bl,
194  const TVector3& br,
195  int color);
196  void DrawSphere(vector<CbmRichRonchiIntersectionData>& data);
197  void DrawRLocMum(vector<CbmRichRonchiIntersectionData>& data);
198 
199  void DoHeight(vector<CbmRichRonchiIntersectionData>& intersections);
200 
201  void DoSphere(vector<CbmRichRonchiIntersectionData>& intersections);
202 
203  int GetIndexForLineXLineY(int lineX,
204  int lineY,
205  vector<CbmRichRonchiIntersectionData>& data);
206  int GetMinIndexForLineX(int lineX,
207  vector<CbmRichRonchiIntersectionData>& data);
208  int GetMinIndexForLineY(int lineY,
209  vector<CbmRichRonchiIntersectionData>& data);
210 
211  void DoHeightCorners(vector<CbmRichRonchiIntersectionData>& intersections);
212 
213  void DoScanLineHeight(vector<CbmRichRonchiIntersectionData>& intersections);
214 
215  void
216  DoCalculateRemaining(vector<CbmRichRonchiIntersectionData>& intersections);
217 
218  void DoIntegrate(vector<CbmRichRonchiIntersectionData>& intersections);
219 
220  void
221  DoAverageSurroundings(vector<CbmRichRonchiIntersectionData>& intersections);
222 
223  void RotatePointImpl(TVector3* inPos,
224  TVector3* outPos,
225  Double_t rotX,
226  Double_t rotY,
227  TVector3* cV);
228 
229  void DoDeviation(vector<CbmRichRonchiIntersectionData>& data);
230 
231  void DoRLoc(vector<CbmRichRonchiIntersectionData>& data);
232 
237 
242 
243  ClassDef(CbmRichRonchiAna, 1)
244 };
245 
246 #endif /* RICH_MIRRORS_CBMRICHRONCHIANA_H_ */
CbmRichRonchiAna::fImageCenterMirrorY
double fImageCenterMirrorY
Definition: CbmRichRonchiAna.h:146
CbmRichRonchiAna::DoIntegrate
void DoIntegrate(vector< CbmRichRonchiIntersectionData > &intersections)
CbmRichRonchiIntersectionData::fMirrorV
TVector3 fMirrorV
Definition: CbmRichRonchiAna.h:64
CbmRichRonchiAna::DoHeight
void DoHeight(vector< CbmRichRonchiIntersectionData > &intersections)
CbmRichRonchiIntersectionData::fVecTR
std::vector< double > fVecTR
Definition: CbmRichRonchiAna.h:84
CbmRichRonchiAna::DoAverageSurroundings
void DoAverageSurroundings(vector< CbmRichRonchiIntersectionData > &intersections)
CbmRichRonchiIntersectionData::fBRRot
TVector3 fBRRot
Definition: CbmRichRonchiAna.h:74
CbmRichRonchiAna::fImageCenterMirrorX
double fImageCenterMirrorX
Definition: CbmRichRonchiAna.h:145
CbmRichRonchiIntersectionData::fBR
TVector3 fBR
Definition: CbmRichRonchiAna.h:69
CbmRichRonchiAna::fDistRulingCCD
double fDistRulingCCD
Definition: CbmRichRonchiAna.h:127
CbmRichRonchiIntersectionData::fNormalRadY
double fNormalRadY
Definition: CbmRichRonchiAna.h:57
CbmRichRonchiIntersectionData::fPixelX
int fPixelX
Definition: CbmRichRonchiAna.h:51
CbmRichRonchiLineData::fMeanSecondary
double fMeanSecondary
Definition: CbmRichRonchiAna.h:99
CbmRichRonchiIntersectionData::fLineY
int fLineY
Definition: CbmRichRonchiAna.h:54
CbmRichRonchiIntersectionData::fPixelY
int fPixelY
Definition: CbmRichRonchiAna.h:52
CbmRichRonchiIntersectionData::fRLoc
double fRLoc
Definition: CbmRichRonchiAna.h:89
CbmRichRonchiAna
Definition: CbmRichRonchiAna.h:103
CbmRichRonchiLineData::fLineInd
int fLineInd
Definition: CbmRichRonchiAna.h:100
CbmRichRonchiAna::operator=
CbmRichRonchiAna & operator=(const CbmRichRonchiAna &)
Assignment operator.
CbmRichRonchiAna::DoCalculateRemaining
void DoCalculateRemaining(vector< CbmRichRonchiIntersectionData > &intersections)
CbmRichRonchiIntersectionData::fNormalRadX
double fNormalRadX
Definition: CbmRichRonchiAna.h:56
CbmRichRonchiAna::fCenterCcdY
double fCenterCcdY
Definition: CbmRichRonchiAna.h:143
CbmRichRonchiIntersectionData::fBLSph
TVector3 fBLSph
Definition: CbmRichRonchiAna.h:78
CbmRichRonchiAna::DoRLoc
void DoRLoc(vector< CbmRichRonchiIntersectionData > &data)
CbmRichRonchiAna::fEdgeLengthCCD
double fEdgeLengthCCD
Definition: CbmRichRonchiAna.h:121
CbmRichRonchiIntersectionData::fTLRot
TVector3 fTLRot
Definition: CbmRichRonchiAna.h:71
CbmRichRonchiLineData
Definition: CbmRichRonchiAna.h:92
CbmRichRonchiIntersectionData::fTLSph
TVector3 fTLSph
Definition: CbmRichRonchiAna.h:76
CbmRichRonchiAna::CbmRichRonchiAna
CbmRichRonchiAna(const CbmRichRonchiAna &)
Copy constructor.
CbmRichRonchiIntersectionData::fLineX
int fLineX
Definition: CbmRichRonchiAna.h:53
CbmRichRonchiAna::fOffsetLEDOpticalAxisY
double fOffsetLEDOpticalAxisY
Definition: CbmRichRonchiAna.h:136
CbmRichRonchiIntersectionData::fOrderedLineX
int fOrderedLineX
Definition: CbmRichRonchiAna.h:59
CbmRichRonchiIntersectionData::fTL
TVector3 fTL
Definition: CbmRichRonchiAna.h:66
CbmRichRonchiIntersectionData::fDeviation
double fDeviation
Definition: CbmRichRonchiAna.h:88
CbmRichRonchiAna::fOffsetCCDOptAxisY
double fOffsetCCDOptAxisY
Definition: CbmRichRonchiAna.h:133
CbmRichRonchiIntersectionData::fBLRot
TVector3 fBLRot
Definition: CbmRichRonchiAna.h:73
CbmRichRonchiAna::fTiffFileNameV
string fTiffFileNameV
Definition: CbmRichRonchiAna.h:115
CbmRichRonchiLineData::CbmRichRonchiLineData
CbmRichRonchiLineData()
Definition: CbmRichRonchiAna.h:94
CbmRichRonchiIntersectionData::fCcdV
TVector3 fCcdV
Definition: CbmRichRonchiAna.h:62
CbmRichRonchiAna::DoScanLineHeight
void DoScanLineHeight(vector< CbmRichRonchiIntersectionData > &intersections)
CbmRichRonchiIntersectionData::fVecBL
std::vector< double > fVecBL
Definition: CbmRichRonchiAna.h:85
CbmRichRonchiIntersectionData::fTR
TVector3 fTR
Definition: CbmRichRonchiAna.h:67
CbmRichRonchiIntersectionData::fVecTL
std::vector< double > fVecTL
Definition: CbmRichRonchiAna.h:83
CbmRichRonchiAna::fOffsetLEDOpticalAxisX
double fOffsetLEDOpticalAxisX
Definition: CbmRichRonchiAna.h:135
CbmRichRonchiAna::DrawRLocMum
void DrawRLocMum(vector< CbmRichRonchiIntersectionData > &data)
CbmRichRonchiAna::fCenterCcdX
double fCenterCcdX
Definition: CbmRichRonchiAna.h:142
CbmRichRonchiLineData::fMeanPrimary
double fMeanPrimary
Definition: CbmRichRonchiAna.h:98
CbmRichRonchiAna::SetTiffFileNameH
void SetTiffFileNameH(const string &fileName)
Definition: CbmRichRonchiAna.h:112
CbmRichRonchiLineData::fNofPoints
int fNofPoints
Definition: CbmRichRonchiAna.h:97
CbmRichRonchiAna::fCorrection
double fCorrection
Definition: CbmRichRonchiAna.h:138
CbmRichRonchiAna::fPi
double fPi
Definition: CbmRichRonchiAna.h:119
CbmRichRonchiAna::fDistMirrorRuling
double fDistMirrorRuling
Definition: CbmRichRonchiAna.h:129
CbmRichRonchiAna::SetTiffFileNameV
void SetTiffFileNameV(const string &fileName)
Definition: CbmRichRonchiAna.h:111
CbmRichRonchiAna::fCcdPixelSize
double fCcdPixelSize
Definition: CbmRichRonchiAna.h:122
CbmRichRonchiAna::fPitchGrid
double fPitchGrid
Definition: CbmRichRonchiAna.h:123
CbmRichRonchiAna::fTiffFileNameH
string fTiffFileNameH
Definition: CbmRichRonchiAna.h:116
CbmRichRonchiIntersectionData::fTRSph
TVector3 fTRSph
Definition: CbmRichRonchiAna.h:77
CbmRichRonchiIntersectionData::fBRSph
TVector3 fBRSph
Definition: CbmRichRonchiAna.h:79
CbmRichRonchiAna::fOffsetCCDOptAxisX
double fOffsetCCDOptAxisX
Definition: CbmRichRonchiAna.h:131
CbmRichRonchiAna::DrawSphere
void DrawSphere(vector< CbmRichRonchiIntersectionData > &data)
CbmRichRonchiIntersectionData::fOrderedLineY
int fOrderedLineY
Definition: CbmRichRonchiAna.h:60
CbmRichRonchiAna::fImageWidth
double fImageWidth
Definition: CbmRichRonchiAna.h:124
CbmRichRonchiAna::fDistMirrorCCD
double fDistMirrorCCD
Definition: CbmRichRonchiAna.h:128
CbmRichRonchiIntersectionData::fTRRot
TVector3 fTRRot
Definition: CbmRichRonchiAna.h:72
CbmRichRonchiIntersectionData::CbmRichRonchiIntersectionData
CbmRichRonchiIntersectionData()
Definition: CbmRichRonchiAna.h:16
CbmRichRonchiIntersectionData::fVecBR
std::vector< double > fVecBR
Definition: CbmRichRonchiAna.h:86
CbmRichRonchiIntersectionData
Definition: CbmRichRonchiAna.h:14
CbmRichRonchiIntersectionData::fRulingV
TVector3 fRulingV
Definition: CbmRichRonchiAna.h:63
CbmRichRonchiAna::DoHeightCorners
void DoHeightCorners(vector< CbmRichRonchiIntersectionData > &intersections)
CbmRichRonchiIntersectionData::fBL
TVector3 fBL
Definition: CbmRichRonchiAna.h:68
CbmRichRonchiAna::fRadiusMirror
double fRadiusMirror
Definition: CbmRichRonchiAna.h:120