CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemMidDriftPlane.cxx
Go to the documentation of this file.
2
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/IMessageSvc.h"
5#include "GaudiKernel/StatusCode.h"
6#include "GaudiKernel/ISvcLocator.h"
7#include "GaudiKernel/Bootstrap.h"
8#include "GaudiKernel/SmartDataPtr.h"
9#include "GaudiKernel/IDataProviderSvc.h"
10#include "GaudiKernel/PropertyMgr.h"
11
12#include <iostream>
13#include <fstream>
14#include <iomanip>
15
16using namespace std;
17
19}
20
22}
23
25 HepPoint3D& posUp, HepPoint3D& posDown,
26 double phiVUp[], double phiVDown[]){
27
28
29 //cout<<"Make sure the layer here is the VIRTUAL layer !!!"<<endl;
30 int layer_geo = int(layer_vir/2);
31 posDown = pLine.xAtR(m_rad[layer_geo], 1);
32 xyzToPhiVIdealGeom(layer_geo, posDown, phiVDown);
33
34 posUp = pLine.xAtR(m_rad[layer_geo], -1);
35 xyzToPhiVIdealGeom(layer_geo, posUp, phiVUp);
36
37 return true;
38}
39
41 HepPoint3D& posUp, HepPoint3D& posDown,
42 double phiVUp[], double phiVDown[]){
43 return getPointIdealGeom(layer_vir, *pLine, posUp, posDown, phiVUp, phiVDown);
44}
45
46
47bool CgemMidDriftPlane::getPointIdealGeom(int layer_geo, int sheet, StraightLine pLine,
48 HepPoint3D& posUp, HepPoint3D& posDown,
49 double phiVUp[], double phiVDown[]){
50
51 posDown = pLine.xAtR(m_rad[layer_geo], 1);
52 xyzToPhiVIdealGeom(layer_geo, posDown, phiVDown);
53
54 posUp = pLine.xAtR(m_rad[layer_geo], -1);
55 xyzToPhiVIdealGeom(layer_geo, posUp, phiVUp);
56
57 return true;
58}
59
60bool CgemMidDriftPlane::getPointIdealGeom(int layer_geo, int sheet, StraightLine* pLine,
61 HepPoint3D& posUp, HepPoint3D& posDown,
62 double phiVUp[], double phiVDown[]){
63 return getPointIdealGeom(layer_geo, sheet, *pLine, posUp, posDown, phiVUp, phiVDown);
64}
65
66
67// for the functions that only return one intersection
68
69
70
72 HepPoint3D& pos,
73 double phiV[]){
74
75 //cout<<"Make sure the layer here is the VIRTUAL layer !!!"<<endl;
76 int layer_geo = int(layer_vir/2);
77
78 if(layer_vir%2==0)
79 {
80 pos = pLine.xAtR(m_rad[layer_geo], 1);
81 xyzToPhiVIdealGeom(layer_geo, pos, phiV);
82 }
83 else
84 {
85 pos = pLine.xAtR(m_rad[layer_geo], -1);
86 xyzToPhiVIdealGeom(layer_geo, pos, phiV);
87 }
88
89 return true;
90}
91
92
93
95 HepPoint3D& pos,
96 double phiV[]){
97 return getPointIdealGeom(layer_vir, *pLine, pos, phiV);
98}
99
100
101bool CgemMidDriftPlane::getPointIdealGeom(int layer_geo, int sheet, StraightLine pLine,
102 HepPoint3D& pos,
103 double phiV[]){
104 if(sheet%2==0)
105 {
106 pos = pLine.xAtR(m_rad[layer_geo], 1);
107 xyzToPhiVIdealGeom(layer_geo, pos, phiV);
108 }
109 else{
110 pos = pLine.xAtR(m_rad[layer_geo], -1);
111 xyzToPhiVIdealGeom(layer_geo, pos, phiV);
112 }
113 return true;
114}
115
116
117bool CgemMidDriftPlane::getPointIdealGeom(int layer_geo, int sheet, StraightLine* pLine,
118 HepPoint3D& pos,
119 double phiV[]){
120 return getPointIdealGeom(layer_geo, sheet, *pLine, pos, phiV);
121}
122
123
124// for the functions that only return one intersection
125
126
127
128
129
130
131
132// bool CgemMidDriftPlane::getPointAligned(int layer, StraightLine pLine,
133// HepPoint3D& posUp, HepPoint3D& posDown,
134// double phiVUp[], double phiVDown[]){
135//
136// int layer_geo = int(layer/2);
137// double trk[4];
138// trk[0] = pLine.dr();
139// trk[1] = pLine.phi0();
140// trk[2] = pLine.dz();
141// trk[3] = pLine.tanl();
142//
143// double trkCnv[4];
144// StraightLine lineCnv = m_align->StraightLineConversion(layer, pLine);
145//
146// HepPoint3D posDownLocal = lineCnv.xAtR(m_rad[layer_geo], 1);
147// xyzToPhiVIdealGeom(layer_geo, posDownLocal, phiVDown);
148// posDown = m_align->point_invTransform(layer, posDownLocal);
149//
150// HepPoint3D posUpLocal = lineCnv.xAtR(m_rad[layer_geo], -1);
151// xyzToPhiVIdealGeom(layer_geo, posUpLocal, phiVUp);
152// posUp = m_align->point_invTransform(layer, posUpLocal);
153//
154// return true;
155// }
156
157// bool CgemMidDriftPlane::getPointAligned(int layer, StraightLine* pLine,
158// HepPoint3D& posUp, HepPoint3D& posDown,
159// double phiVUp[], double phiVDown[]){
160// return getPointAligned(layer, *pLine, posUp, posDown, phiVUp, phiVDown);
161// }
162
163
165 HepPoint3D& posUp, HepPoint3D& posDown,
166 double phiVUp[], double phiVDown[]){
167
168
169 //cout<<"Make sure the layer here is the VIRTUAL layer !!!"<<endl;
170 int layer_geo = int(layer_vir/2);
171
172 ToyRay Aray(pLine.dr(),pLine.phi0(),pLine.dz(),pLine.tanl());
173
174 Hep3Vector GposUp, GposDown;
175 bool findInter = m_align->getinter(Aray, layer_vir, GposUp, GposDown);
176
177 if(!findInter)
178 {
179 posUp.setX(99999.);
180 posUp.setY(99999.);
181 posUp.setZ(99999.);
182
183 posDown.setX(99999.);
184 posDown.setY(99999.);
185 posDown.setZ(99999.);
186
187 phiVUp[0]=99999.;
188 phiVUp[1]=99999.;
189 phiVDown[0]=99999.;
190 phiVDown[1]=99999.;
191 return false;
192 }
193 else
194 {
195 posUp.setX(GposUp.x());
196 posUp.setY(GposUp.y());
197 posUp.setZ(GposUp.z());
198
199 posDown.setX(GposDown.x());
200 posDown.setY(GposDown.y());
201 posDown.setZ(GposDown.z());
202
203 HepPoint3D LposUp, LposDown;
204 m_align->GetLocPos(layer_vir, GposUp, GposDown, LposUp, LposDown);
205
206 xyzToPhiVIdealGeom(layer_geo, LposUp, phiVUp);
207 xyzToPhiVIdealGeom(layer_geo, LposDown, phiVDown);
208
209 return true;
210 }
211}
212
214 HepPoint3D& posUp, HepPoint3D& posDown,
215 double phiVUp[], double phiVDown[]){
216 return getPointAligned(layer_vir, *pLine, posUp, posDown, phiVUp, phiVDown);
217}
218
219//*******************************************************************************************
220
221bool CgemMidDriftPlane::getPointAligned(int layer_geo, int sheet, StraightLine pLine,
222 HepPoint3D& posUp, HepPoint3D& posDown,
223 double phiVUp[], double phiVDown[]){
224 //int layer_geo = int(layer_vir/2);
225 int layer_vir = layer_geo*2+sheet;
226
227 ToyRay Aray(pLine.dr(),pLine.phi0(),pLine.dz(),pLine.tanl());
228
229 Hep3Vector GposUp, GposDown;
230 bool findInter = m_align->getinter(Aray, layer_vir, GposUp, GposDown);
231
232 if(!findInter)
233 {
234 posUp.setX(99999.);
235 posUp.setY(99999.);
236 posUp.setZ(99999.);
237
238 posDown.setX(99999.);
239 posDown.setY(99999.);
240 posDown.setZ(99999.);
241
242 phiVUp[0]=99999.;
243 phiVUp[1]=99999.;
244 phiVDown[0]=99999.;
245 phiVDown[1]=99999.;
246 return false;
247 }
248 else
249 {
250 posUp.setX(GposUp.x());
251 posUp.setY(GposUp.y());
252 posUp.setZ(GposUp.z());
253
254 posDown.setX(GposDown.x());
255 posDown.setY(GposDown.y());
256 posDown.setZ(GposDown.z());
257
258 HepPoint3D LposUp, LposDown;
259 m_align->GetLocPos(layer_vir, GposUp, GposDown, LposUp, LposDown);
260
261 xyzToPhiVIdealGeom(layer_geo, LposUp, phiVUp);
262 xyzToPhiVIdealGeom(layer_geo, LposDown, phiVDown);
263
264 return true;
265 }
266}
267
268bool CgemMidDriftPlane::getPointAligned(int layer_geo, int sheet, StraightLine* pLine,
269 HepPoint3D& posUp, HepPoint3D& posDown,
270 double phiVUp[], double phiVDown[]){
271 return getPointAligned(layer_geo, sheet, *pLine, posUp, posDown, phiVUp, phiVDown);
272}
273
274
275
276
277// for the functions that only return one intersection
278//*******************************************************************************************
279
280
282 HepPoint3D& pos,
283 double phiV[]){
284
285
286 //cout<<"Make sure the layer here is the VIRTUAL layer !!!"<<endl;
287 int layer_geo = int(layer_vir/2);
288
289 ToyRay Aray(pLine.dr(),pLine.phi0(),pLine.dz(),pLine.tanl());
290
291 Hep3Vector Gpos;
292 bool findInter = m_align->getinter(Aray, layer_vir, Gpos);
293
294 if(!findInter)
295 {
296 pos.setX(99999.);
297 pos.setY(99999.);
298 pos.setZ(99999.);
299
300 phiV[0]=99999.;
301 phiV[1]=99999.;
302 return false;
303 }
304 else
305 {
306 pos.setX(Gpos.x());
307 pos.setY(Gpos.y());
308 pos.setZ(Gpos.z());
309
310 HepPoint3D Lpos;
311 m_align->GetLocPos(layer_vir, Gpos, Lpos);
312 xyzToPhiVIdealGeom(layer_geo, Lpos, phiV);
313
314 return true;
315 }
316}
317
319 HepPoint3D& pos,
320 double phiV[]){
321 return getPointAligned(layer_vir, *pLine, pos, phiV);
322}
323
324//*******************************************************************************************
325
326bool CgemMidDriftPlane::getPointAligned(int layer_geo, int sheet, StraightLine pLine,
327 HepPoint3D& pos,
328 double phiV[]){
329 //int layer_geo = int(layer_vir/2);
330 int layer_vir = layer_geo*2+sheet;
331
332 ToyRay Aray(pLine.dr(),pLine.phi0(),pLine.dz(),pLine.tanl());
333
334 Hep3Vector Gpos;
335 bool findInter = m_align->getinter(Aray, layer_vir, Gpos);
336
337 if(!findInter)
338 {
339 pos.setX(99999.);
340 pos.setY(99999.);
341 pos.setZ(99999.);
342
343 phiV[0]=99999.;
344 phiV[1]=99999.;
345 return false;
346 }
347 else
348 {
349 pos.setX(Gpos.x());
350 pos.setY(Gpos.y());
351 pos.setZ(Gpos.z());
352
353 HepPoint3D Lpos;
354 m_align->GetLocPos(layer_vir, Gpos, Lpos);
355
356 xyzToPhiVIdealGeom(layer_geo, Lpos, phiV);
357
358 return true;
359 }
360}
361
362bool CgemMidDriftPlane::getPointAligned(int layer_geo, int sheet, StraightLine* pLine,
363 HepPoint3D& pos,
364 double phiV[]){
365 return getPointAligned(layer_geo, sheet, *pLine, pos, phiV);
366}
367
368
369// for the functions that only return one intersection
370
371
372
373
374//*******************************************************************************************
375// bool CgemMidDriftPlane::getPointAligned(int layer_geo, int sheet, int layer_vir, StraightLine pLine,
376// HepPoint3D& posUp, HepPoint3D& posDown,
377// double phiVUp[], double phiVDown[]){
378// //int layer_geo = int(layer_vir/2);
379//
380// ToyRay Aray(pLine.dr(),pLine.phi0(),pLine.dz(),pLine.tanl());
381//
382// Hep3Vector GposUp, GposDown;
383// bool findInter = m_align->getinter(Aray, layer_vir, GposUp, GposDown);
384//
385// if(!findInter)
386// {
387// posUp.setX(99999.);
388// posUp.setY(99999.);
389// posUp.setZ(99999.);
390//
391// posDown.setX(99999.);
392// posDown.setY(99999.);
393// posDown.setZ(99999.);
394//
395// phiVUp[0]=99999.;
396// phiVUp[1]=99999.;
397// phiVDown[0]=99999.;
398// phiVDown[1]=99999.;
399// return false;
400// }
401// else
402// {
403// posUp.setX(GposUp.x());
404// posUp.setY(GposUp.y());
405// posUp.setZ(GposUp.z());
406//
407// posDown.setX(GposDown.x());
408// posDown.setY(GposDown.y());
409// posDown.setZ(GposDown.z());
410//
411// HepPoint3D LposUp, LposDown;
412// m_align->GetLocPos(layer_vir, GposUp, GposDown, LposUp, LposDown);
413//
414// xyzToPhiVIdealGeom(layer_geo, LposUp, phiVUp);
415// xyzToPhiVIdealGeom(layer_geo, LposDown, phiVDown);
416//
417// return true;
418// }
419// }
420//
421// bool CgemMidDriftPlane::getPointAligned(int layer_geo, int sheet, int layer_vir, StraightLine* pLine,
422// HepPoint3D& posUp, HepPoint3D& posDown,
423// double phiVUp[], double phiVDown[]){
424// return getPointAligned(layer_geo, sheet, layer_vir, *pLine, posUp, posDown, phiVUp, phiVDown);
425// }
426
427
428
429
430
431bool CgemMidDriftPlane::xyzToPhiVIdealGeom(int layer_geo, HepPoint3D pos, double phiV[]){
432 double phi=pos.phi();
433 double z =pos.z();
434 phiV[0]=phi;
435 phiV[1]=99999.;
436 int nSheet=2; if(layer_geo==0) nSheet=1;
437 for(int iSheet=0; iSheet<nSheet; iSheet++)
438 {
439 if(m_readoutPlane[layer_geo][iSheet]->OnThePlane(phi,z))
440 {
441 phiV[1]=m_readoutPlane[layer_geo][iSheet]->getVFromPhiZ(phi,z);
442 break;
443 }
444 }
445
446 return true;
447}
void GetLocPos(int layer_vir, Hep3Vector GposUp, Hep3Vector GposDown, HepPoint3D &LposUp, HepPoint3D &LposDown)
bool getinter(ToyRay ARay, int layer_vir, Hep3Vector &posUp, Hep3Vector &posDown)
double getVFromPhiZ(double phi, double z, bool checkRange=true) const
bool getPointIdealGeom(int layer_vir, StraightLine pLine, HepPoint3D &posUp, HepPoint3D &posDown, double phiVUp[], double phiVDown[])
bool getPointAligned(int layer_vir, StraightLine pLine, HepPoint3D &posUp, HepPoint3D &posDown, double phiVUp[], double phiVDown[])
bool xyzToPhiVIdealGeom(int layer_geo, HepPoint3D pos, double phiV[])
double dz(void) const
Definition: StraightLine.h:48
HepPoint3D xAtR(double R, int direction=1) const
double dr(void) const
returns an element of parameters.
Definition: StraightLine.h:45
double tanl(void) const
Definition: StraightLine.h:49
double phi0(void) const
Definition: StraightLine.h:46