BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
MucGeoGap.cxx
Go to the documentation of this file.
1//$id$
2//
3//$log$
4
5/*
6 * 2003/08/30 Zhengyun You Peking University
7 *
8 * 2004/09/09 Zhengyun You Peking University
9 * transplanted to Gaudi framework
10 */
11
12#include <iostream>
13#include <vector>
14#include "TGeoBBox.h"
15
16#include "MucGeomSvc/MucGeoGap.h"
17#include "MucGeomSvc/MucGeoStrip.h"
18#include "MucGeomSvc/MucGeometron.h"
19#include "MucGeomSvc/MucConstant.h"
20#include "Identifier/MucID.h"
21
22using namespace std;
23
25 : m_Part(-1),
26 m_Seg(-1),
27 m_Gap(-1),
28 m_StripNum(-1),
29 m_XSize(-1.0),
30 m_YSize(-1.0),
31 m_ZSize(-1.0)
32{
33 // Default constructor.
34}
35
36MucGeoGap::MucGeoGap(const int part,
37 const int seg,
38 const int gap,
39 const int orient,
40 const int stripNum,
41 const float xSize,
42 const float ySize,
43 const float zSize,
44 const float xTarget1Global,
45 const float yTarget1Global,
46 const float zTarget1Global,
47 const float xTarget2Global,
48 const float yTarget2Global,
49 const float zTarget2Global,
50 const float xTarget3Global,
51 const float yTarget3Global,
52 const float zTarget3Global,
53 const float dzHighEdge,
54 const float dzFarFrontGas,
55 const float dzNearFrontGas,
56 const float dzNearBackGas,
57 const float dzFarBackGas,
58 const float dxTarget1ToFiducial,
59 const float dyTarget1ToFiducial,
60 const float dxFiducialToCenter,
61 const float dyFiducialToCenter)
62 : m_Part(part),
63 m_Seg(seg),
64 m_Gap(gap),
65 m_StripNum(stripNum),
66 m_Orient(orient),
67 m_XSize(xSize),
68 m_YSize(ySize),
69 m_ZSize(zSize),
70 m_dzHighEdge(dzHighEdge),
71 m_dzFarFrontGas(dzFarFrontGas),
72 m_dzNearFrontGas(dzNearFrontGas),
73 m_dzNearBackGas(dzNearBackGas),
74 m_dzFarBackGas(dzFarBackGas),
75 m_pMucGeoStrip(MucID::getStripNum(part, seg, gap))
76{
77 // Real constructor (construct strips externally).
78
79 // v1Global, v2Global, v3Global are position vectors of the three survey targets in the
80 // Bes global coordinate system.
81 //cout << m_dzHighEdge << " " << m_dzFarFrontGas << " " << m_dzNearFrontGas << " " << dzNearBackGas << " " << dzFarBackGas << endl;
82 Hep3Vector v1Global(xTarget1Global, yTarget1Global, zTarget1Global);
83 Hep3Vector v2Global(xTarget2Global, yTarget2Global, zTarget2Global);
84 Hep3Vector v3Global(xTarget3Global, yTarget3Global, zTarget3Global);
85
86 Hep3Vector v2To1Global = v1Global - v2Global;
87 Hep3Vector v3To1Global = v1Global - v3Global;
88
89 // v1Gap is the position vector of target1 in the gap coordinate system.
90 Hep3Vector v1Gap(dxTarget1ToFiducial + dxFiducialToCenter,
91 dyTarget1ToFiducial + dyFiducialToCenter,
92 0.0);
93
94 // Make rotaiton and translation matrix.
95 Hep3Vector newX(1,0,0), newY(0,1,0), newZ(0,0,1);
96 HepRotation rotateGap(newX, newY, newZ);
97
98 if(part == 1) {
99 newX = v2To1Global;
100 newX.setMag(1.0);
101 newY = v3To1Global;
102 newY.setMag(1.0);
103 newZ = newX.cross(newY);
104 }
105 if(part != 1) {
106 newY = -1.0*v2To1Global;
107 newY.setMag(1.0);
108 newZ = v3To1Global.cross(newY);
109 newZ.setMag(1.0);
110 newX = newY.cross(newZ);
111 }
112
113 HepRotation rotateGlobal(newX, newY, newZ);
114 HepRotation rotateGapToGlobal(rotateGlobal * rotateGap);
115
116 Hep3Vector translateGapToGlobal(v1Global - rotateGapToGlobal * v1Gap);
117
118 m_Rotation = rotateGapToGlobal;
119 m_Translation = translateGapToGlobal;
120 m_Center = m_Translation;
121
122 //cout << " Rotation : " << endl << m_Rotation.xx() << " " << m_Rotation.xy() << " " << m_Rotation.xz() << endl << m_Rotation.yx() << " " << m_Rotation.yy() << " " << m_Rotation.yz() << endl << m_Rotation.zx() << " " << m_Rotation.zy() << " " << m_Rotation.zz() << endl;
123 //cout << " Center : " << m_Center << endl;
124
125 HepMatrix rM(3,3), rMT(3,3);
126 for(int i=0; i<3; i++){
127 for(int j=0; j<3; j++){
128 rM[i][j] = m_Rotation(i,j);
129 }
130 }
131 rMT = rM.T();
132
133 Hep3Vector newXT(rMT(1,1),rMT(2,1),rMT(3,1));
134 Hep3Vector newYT(rMT(1,2),rMT(2,2),rMT(3,2));
135 Hep3Vector newZT(rMT(1,3),rMT(2,3),rMT(3,3));
136 HepRotation rotateGlobalToGap(newXT,newYT,newZT);
137
138 m_RotationT = rotateGlobalToGap;
139}
140
141/// ROOT constructor.
142MucGeoGap::MucGeoGap(const int part,
143 const int seg,
144 const int gap,
145 const int orient,
146 const int stripNum,
147 const TGeoPhysicalNode *gapPhysicalNode,
148 const float ironThickness)
149 : m_Part(part),
150 m_Seg(seg),
151 m_Gap(gap),
152 m_StripNum(stripNum),
153 m_Orient(orient),
154 m_pMucGeoStrip(MucID::getStripNum(part, seg, gap)),
155 m_IronThickness(ironThickness)
156
157{
158 TGeoBBox *gapBox = (TGeoBBox*)gapPhysicalNode->GetShape();
159
160 m_XSize = gapBox->GetDX() * 2.0;
161 m_YSize = gapBox->GetDY() * 2.0;
162 m_ZSize = gapBox->GetDZ() * 2.0;
163
164 m_dzHighEdge = 20.0;
165 m_dzFarFrontGas = -4.5;
166 m_dzNearFrontGas = -2.5;
167 m_dzNearBackGas = 2.5;
168 m_dzFarBackGas = 4.5;
169
170 double eRot[9], *pRot;
171 pRot = eRot;
172 pRot = gapPhysicalNode->GetMatrix()->GetRotationMatrix();
173
174 //cout << "part " << part << " seg " << seg << " gap " << gap << endl;
175 //cout << pRot[0] << " " << pRot[1] << " " << pRot[2] << endl
176 // << pRot[3] << " " << pRot[4] << " " << pRot[5] << endl
177 // << pRot[6] << " " << pRot[7] << " " << pRot[8] << endl;
178 Hep3Vector rotX(pRot[0], pRot[3], pRot[6]);
179 Hep3Vector rotY(pRot[1], pRot[4], pRot[7]);
180 Hep3Vector rotZ(pRot[2], pRot[5], pRot[8]);
181 HepRotation rotateGapToGlobal(rotX, rotY, rotZ);
182 m_Rotation = rotateGapToGlobal;
183
184 Hep3Vector rotTX(pRot[0], pRot[1], pRot[2]);
185 Hep3Vector rotTY(pRot[3], pRot[4], pRot[5]);
186 Hep3Vector rotTZ(pRot[6], pRot[7], pRot[8]);
187 HepRotation rotateGlobalToGap(rotTX, rotTY, rotTZ);
188 m_RotationT = rotateGlobalToGap;
189
190 double eTrans[3], *pTrans;
191 pTrans = eTrans;
192 pTrans = gapPhysicalNode->GetMatrix()->GetTranslation();
193
194 Hep3Vector translateGapToGlobal(pTrans[0], pTrans[1], pTrans[2]);
195 m_Translation = translateGapToGlobal;
196 m_Center = m_Translation;
197
198
199 double eTrans_gap[3], *pTrans_gap; //pTran is for box now!!!
200 pTrans_gap = eTrans_gap;
201 pTrans_gap = gapPhysicalNode->GetMatrix(2)->GetTranslation();
202 //std::cout <<"gap position: "<<pTrans_gap[0]<< " " << pTrans_gap[1] << " " << pTrans_gap[2] << std::endl;
203
204 Hep3Vector GapSurface1, GapSurface2;
205 Hep3Vector GapCenter(pTrans_gap[0], pTrans_gap[1], pTrans_gap[2]);
206 GapSurface1 = GapCenter - rotZ * 20; //Gap thickness/2= 20
207 GapSurface2 = GapCenter + rotZ * 20; //Gap thickness/2= 20
208
209 m_SurfaceInner = GapSurface1;
210 m_SurfaceOuter = GapSurface2;
211 if(GapSurface1.mag()>GapSurface2.mag())//keep Inner be the little one
212 {
213 m_SurfaceInner = GapSurface2;
214 m_SurfaceOuter = GapSurface1;
215 }
216
217 // std::cout <<"sur1 position: "<<GapSurface1[0]<<" "<<GapSurface1[1]<<" "<<GapSurface1[2]<<std::endl;
218// std::cout <<"sur2 position: "<<GapSurface2[0]<<" "<<GapSurface2[1]<<" "<<GapSurface2[2]<<std::endl;
219// std::cout <<"box position: "<< pTrans[0] << " " << pTrans[1] << " " << pTrans[2] << std::endl;
220}
221
222MucGeoGap&
224{
225 // Assignment operator.
226 if (this != &orig) { // Watch out for self-assignment!
227 m_Part = orig.m_Part;
228 m_Seg = orig.m_Seg;
229 m_Gap = orig.m_Gap;
230 m_StripNum = orig.m_StripNum;
231 m_Orient = orig.m_Orient;
232 m_HitStatus = orig.m_HitStatus;
233
234 m_XSize = orig.m_XSize;
235 m_YSize = orig.m_YSize;
236 m_ZSize = orig.m_ZSize;
237
238 m_dzHighEdge = orig.m_dzHighEdge;
239 m_dzFarFrontGas = orig.m_dzFarFrontGas;
240 m_dzNearFrontGas = orig.m_dzNearFrontGas;
241 m_dzNearBackGas = orig.m_dzNearBackGas;
242 m_dzFarBackGas = orig.m_dzFarBackGas;
243
244
245 m_Center = orig.m_Center;
246 m_Rotation = orig.m_Rotation;
247 m_RotationT = orig.m_RotationT;
248 m_Translation = orig.m_Translation;
249
250 m_IronThickness = orig.m_IronThickness;
251
252 m_pMucGeoStrip = orig.m_pMucGeoStrip;
253 }
254 return *this;
255}
256
258 : m_Part(orig.m_Part),
259 m_Seg(m_Seg),
260 m_Gap(m_Gap),
261 m_StripNum(orig.m_StripNum),
262 m_Orient(orig.m_Orient),
263 m_HitStatus(orig.m_HitStatus),
264 m_XSize(orig.m_XSize),
265 m_YSize(orig.m_YSize),
266 m_ZSize(orig.m_ZSize),
267 m_dzHighEdge(orig.m_dzHighEdge),
268 m_dzFarFrontGas(orig.m_dzFarFrontGas),
269 m_dzNearFrontGas(orig.m_dzNearFrontGas),
270 m_dzNearBackGas(orig.m_dzNearBackGas),
271 m_dzFarBackGas(orig.m_dzFarBackGas),
272 m_Center(orig.m_Center),
273 m_Rotation(orig.m_Rotation),
274 m_RotationT(orig.m_RotationT),
275 m_Translation(orig.m_Translation),
276 m_IronThickness(orig.m_IronThickness)
277{
278 // Copy constructor.
279 m_pMucGeoStrip = orig.m_pMucGeoStrip;
280}
281
283{
284 // Destructor.
285 MucGeoStrip* pStrip = 0;
286 while(m_pMucGeoStrip.size() > 0){
287 pStrip = m_pMucGeoStrip.back();
288 delete pStrip;
289 m_pMucGeoStrip.pop_back();
290 }
291}
292
294MucGeoGap::GetStrip(const int strip) const
295{
296 // Point to a strip within this gap.
297 if ( strip < 0 || strip >= int(m_pMucGeoStrip.size()) ) {
298 std::cout << "Error: MucGeoGap::GetStrip() strip " << strip << " exceed strip range" << endl;
299 return 0;
300 }
301 if ( !m_pMucGeoStrip[strip] ) {
302 std::cout << "Error: MucGeoGap::GetStrip() strip " << strip << " not found" << endl;
303 return 0;
304 }
305
306 return m_pMucGeoStrip[strip];
307}
308
309void
310MucGeoGap::GetSize(float &xSize, float &ySize, float &zSize) const
311{
312 // Get size of this gap.
313 xSize = m_XSize;
314 ySize = m_YSize;
315 zSize = m_ZSize;
316
317 return;
318}
319
320void
321MucGeoGap::GetRotationMatrix(float &thetaX, float &phiX,
322 float &thetaY, float &phiY,
323 float &thetaZ, float &phiZ) const
324{
325 // Get the rotation angles (in degrees) of the gap in the global coordinate system.
326 Hep3Vector x(m_Rotation.colX());
327 Hep3Vector y(m_Rotation.colY());
328 Hep3Vector z(m_Rotation.colZ());
329
330 thetaX = kRad * x.theta();
331 phiX = kRad * x.phi();
332 thetaY = kRad * y.theta();
333 phiY = kRad * y.phi();
334 thetaZ = kRad * z.theta();
335 phiZ = kRad * z.phi();
336
337 // cout << "Gap rotation matrix : " << endl
338 // << "X: theta = " << thetaX << " phi = " << phiX << endl
339 // << "Y: theta = " << thetaY << " phi = " << phiY << endl
340 // << "Z: theta = " << thetaZ << " phi = " << phiZ << endl;
341
342 return;
343}
344
345int
347 const float y,
348 const float ) const
349{
350 // Given a position (gap coordinate), find the approximate strip containing the position, as there are intervals between the strips.
351 float x0, y0, z0; // XYZ position of the strip NO min.
352 float xn, yn, zn; // XYZ position of the strip NO max.
353 float dx; // Approximate width of a strip and a interval.
354 int n, iGuess;
355
356 n = m_StripNum - 1;
357
358 GetStrip(0)->GetCenterPos(x0, y0, z0);
359 GetStrip(n)->GetCenterPos(xn, yn, zn);
360
361 //cout << n << endl;
362 //cout << "x0 " << x0 << " xn " << xn << " x " << x << endl;
363 //cout << "y0 " << y0 << " yn " << yn << " y " << y << endl;
364 //cout << "orient " << m_Orient << endl;
365
366 if(m_Orient == 0){
367 dx = (yn-y0)/n;
368 iGuess = int ((y-y0)/dx+0.5);
369 return iGuess;
370 }
371 else{
372 dx = (xn-x0)/n;
373 iGuess = int ((x-x0)/dx+0.5);
374 return iGuess;
375 }
376}
377
380 const Hep3Vector gDirection) const
381{
382 // Given a line by basepoint gPoint and direction gDirection,
383 // find the intersection with the gap (in global coordinate).
384 Hep3Vector gapVect = m_Rotation.colZ();
385 HepPoint3D gCross(0,0,0);
386
387 HepPlane3D plane(gapVect, m_Center);
388 MucGeometron geometron;
389 //bool getPoint =
390 geometron.GetIntersectionLinePlane(gPoint, gDirection, plane, gCross);
391
392 return gCross;
393}
394
397 const Hep3Vector gDirection,
398 const HepPoint3D gPointSigma,
399 const Hep3Vector gDirectionSigma,
400 HepPoint3D &gCross,
401 HepPoint3D &gCrossSigma) const
402{
403 Hep3Vector gapVect = m_Rotation.colZ();
404
405 HepPlane3D plane(gapVect, m_Center);
406 MucGeometron geometron;
407 geometron.GetIntersectionLinePlaneWithSigma(gPoint, gDirection, gPointSigma, gDirectionSigma, plane, gCross, gCrossSigma);
408
409
410 return gCross;
411}
412
413
414void
416 const Hep3Vector gDirection,
417 HepPoint3D& gCross1,
418 HepPoint3D& gCross2 ) const
419{
420 // Given a line by basepoint gPoint and direction gDirection,
421 // find the intersection with the gap (in global coordinate).
422 Hep3Vector gapVect = m_Rotation.colZ();
423
424 HepPlane3D planeInner(gapVect, m_SurfaceInner);
425 HepPlane3D planeOuter(gapVect, m_SurfaceOuter);
426 MucGeometron geometron;
427 //bool getPoint =
428
429 geometron.GetIntersectionLinePlane(gPoint, gDirection, planeInner, gCross1);
430 geometron.GetIntersectionLinePlane(gPoint, gDirection, planeOuter, gCross2);
431
432}
433
435MucGeoGap::ProjectToGapQuadLocal(const int part, //liangyt 2009.3.12
436 const int orient,
437 const float a, //y = ax*x + b*x +c;
438 const float b,
439 const float c,
440 const int whichhalf,
441 HepPoint3D& gCross1,
442 HepPoint3D& gCross2) const
443{
444 Hep3Vector gapVect, center_local;
445 if(part == 1 && orient == 1) {gapVect = m_Rotation.colZ(); center_local = m_Center;}
446 else if(part == 1 && orient == 0) {//in this orientation, the fitting is done in local coordinate.
447 gapVect.setX(0); gapVect.setY(1); gapVect.setZ(0);
448 center_local.setX(0); center_local.setY(m_Center.mag()); center_local.setZ(0);
449 }
450 else {//in this orientation, the fitting is done in local coordinate.
451 gapVect.setX(1); gapVect.setY(0); gapVect.setZ(0);
452 center_local.setX(m_Center.z()); center_local.setY(0); center_local.setZ(0);
453 }
454
455 //cout<<"in mucgeogap: part = "<<part<<" o: "<<orient<<" gapvect: "<<gapVect<<" center = "<<m_Center<<endl;
456 //cout<<"in mucgeogap: center local = "<<center_local<<endl;
457
458 HepPlane3D plane(gapVect, center_local);
459
460 MucGeometron geometron;
461 geometron.GetIntersectionQuadPlaneLocal(part,orient, a, b, c, plane, gCross1, gCross2);
462
463
464}
465
466
468MucGeoGap::ProjectToGap(const HepPoint3D gPoint, //liangyt 2007.4.9
469 const float vy,
470 const float y0,
471 const float a, //y = ax*x + b*x +c;
472 const float b,
473 const float c,
474 const int whichhalf,
475 HepPoint3D& gCross1,
476 HepPoint3D& gCross2) const
477{
478 // Given a line by basepoint gPoint and direction gDirection,
479 // find the intersection with the gap (in global coordinate).
480 Hep3Vector gapVect = m_Rotation.colZ();
481
482 HepPlane3D plane(gapVect, m_Center);
483 MucGeometron geometron;
484 //bool getPoint =
485 geometron.GetIntersectionQuadPlane(gPoint, vy, y0, a, b, c, plane, gCross1, gCross2);
486
487 HepPoint3D localCross = TransformToGap(gCross1);
488
489 bool found = false;
490 bool found1 = false;
491 bool found2 = false;
492 HepPoint3D temp;
493 int good = 0;
494
495 if ( IsInGap(localCross.x(),
496 localCross.y(),
497 localCross.z()) ) {
498 good = 1;
499 found1 = true;
500 }
501
502 localCross = TransformToGap(gCross2);
503 if ( IsInGap(localCross.x(),
504 localCross.y(),
505 localCross.z()) ) {
506 good = 2;
507 found2 = true;
508 }
509 if(found1&&found2) {
510 float center = b/(-2*a);
511 if(whichhalf==2){
512 if(gCross1.x()>center) good = 1;
513 if(gCross2.x()>center) good = 2;
514 }
515 if(whichhalf==1){
516 if(gCross1.x()<center) good = 1;
517 if(gCross2.x()<center) good = 2;
518 }
519 }
520 if(good == 2) {temp = gCross1; gCross1 = gCross2; gCross2 = temp;} //keep gCross1 be the good one!
521 //cout<<"detail: "<<whichhalf<<" "<<gCross1<<" & "<<gCross2<<" "<<a<<" "<<b<<" "<<c<<endl;
522
523 return gCross1;
524}
525
526
527void
528MucGeoGap::ProjectToGapSurface(const HepPoint3D gPoint, //liangyt 2007.4.9
529 const float vy,
530 const float y0,
531 const float a, //y = ax*x + b*x +c;
532 const float b,
533 const float c,
534 const int whichhalf,
535 HepPoint3D& gCross1,
536 HepPoint3D& gCross2) const
537{
538 // Given a line by basepoint gPoint and direction gDirection,
539 // find the intersection with the gap (in global coordinate).
540
541 HepPoint3D cross1, cross2, cross3, cross4;
542
543 Hep3Vector gapVect = m_Rotation.colZ();
544
545 HepPlane3D planeInner(gapVect, m_SurfaceInner);
546 HepPlane3D planeOuter(gapVect, m_SurfaceOuter);
547
548 MucGeometron geometron;
549 //bool getPoint =
550 geometron.GetIntersectionQuadPlane(gPoint, vy, y0, a, b, c, planeInner, cross1, cross2);
551 geometron.GetIntersectionQuadPlane(gPoint, vy, y0, a, b, c, planeOuter, cross3, cross4);
552
553 gCross1 = CompareIntersection(whichhalf, cross1, cross2, a, b, c);
554 gCross2 = CompareIntersection(whichhalf, cross3, cross4, a, b, c);
555
556}
557
559MucGeoGap::CompareIntersection(const int whichhalf, const HepPoint3D gCross1,
560 const HepPoint3D gCross2, const float a,
561 const float b, const float c )const
562{
563 bool found = false;
564 bool found1 = false;
565 bool found2 = false;
566 int good = 0;
567
568 HepPoint3D localCross = TransformToGap(gCross1);
569 if ( IsInGap(localCross.x(),
570 localCross.y(),
571 0.0) ) {
572 good = 1;
573 found1 = true;
574 }
575
576 localCross = TransformToGap(gCross2);
577 if ( IsInGap(localCross.x(),
578 localCross.y(),
579 0.0) ) {
580 good = 2;
581 found2 = true;
582 }
583 if(found1&&found2) {
584 float center = b/(-2*a);
585 if(whichhalf==2){
586 if(gCross1.x()>center) good = 1;
587 if(gCross2.x()>center) good = 2;
588 }
589 if(whichhalf==1){
590 if(gCross1.x()<center) good = 1;
591 if(gCross2.x()<center) good = 2;
592 }
593 }
594
595 if(good == 1) return gCross1;
596 else if(good == 2) return gCross2;
597 else {
598 HepPoint3D Empty(-9999,-9999,-9999);
599 cout<<"in MucGeoGap:: both intersection position are bad!!!"<<endl; return Empty;
600 }
601
602}
603
604
605Hep3Vector
606MucGeoGap::RotateToGlobal(const Hep3Vector pVect) const
607{
608 // Rotate a vector from gap coordinate to Bes global coordinate.
609 return m_Rotation * pVect;
610}
611
612Hep3Vector
613MucGeoGap:: RotateToGap(const Hep3Vector gVect) const
614{
615 // Rotate a vector from Bes global coordinate to gap coordinate.
616 return m_RotationT * gVect;
617}
618
621{
622 // Transform a point from gap coordinate to Bes global coordinate.
623 return m_Rotation * pPoint + m_Translation;
624}
625
628{
629 // Transform a point from Bes global coordinate to gap coordinate.
630 return m_RotationT * (gPoint - m_Translation);
631}
632
633bool
634MucGeoGap::IsInGap(const float x,
635 const float y,
636 const float z) const
637{
638 // Check if the point (given in gap coordinate) is within the gap boundary.
639 return ( ( x > -0.5*m_XSize - kGapEdge ) && ( x < 0.5*m_XSize + kGapEdge ) &&
640 ( y > -0.5*m_YSize - kGapEdge ) && ( y < 0.5*m_YSize + kGapEdge ) &&
641 ( z > ( m_dzHighEdge - m_ZSize ) ) && ( z < m_dzHighEdge ) );
642}
643
645MucGeoGap::AddStrip(const int strip)
646{
647 // Add a strip to the gap.
648 MucGeoStrip *pStrip;
649 MucGeoStrip *neighbor;
650
651 if( strip >= int(m_pMucGeoStrip.size()) ) {
652 cout << " MucGeoGap::AddStrip strip number "
653 << strip << " outside of expected range "
654 << m_pMucGeoStrip.size()
655 << endl;
656 return 0;
657 }
658
659 if( (strip + 1) > m_StripNum ) m_StripNum = strip + 1;
660
661 if(m_pMucGeoStrip[strip]) {
662 // The strip object has already been created; don't create a new one.
663 return m_pMucGeoStrip[strip];
664 }
665
666 pStrip = new MucGeoStrip(strip, this);
667
668 m_pMucGeoStrip[strip] = pStrip;
669 pStrip->SetLeftNeighbor(0L);
670 pStrip->SetRightNeighbor(0L);
671
672 // Make this strip and the previous one neighbors.
673 if ( strip > 0 ) {
674 neighbor = m_pMucGeoStrip[strip-1];
675 if(neighbor) {
676 neighbor->SetRightNeighbor(pStrip);
677 pStrip->SetLeftNeighbor(neighbor);
678 }
679 }
680
681 return pStrip;
682}
683
684ostream&
685operator << (ostream& s, const MucGeoGap& gap)
686{
687 //float x0, y0, z0;
688 float dx, dy, dz;
689 HepPoint3D center;
690 center = gap.GetCenter();
691 gap.GetSize(dx,dy,dz);
692
693 s << " Identifier : " << gap.Part() << " " << gap.Seg() << " " << gap.Gap() << endl;
694 s << " Strip number " << gap.GetStripNum() << endl;
695 s << " Center position (" << center.x() << "," << center.y() << "," << center.z() << ")" << endl;
696 s << " Size (" << dx << "," << dy << "," << dz << ")" << endl;
697
698 return s;
699}
700
701
const Double_t kRad
Definition: BesTView.cxx:34
const Int_t n
Double_t x[10]
XmlRpcServer s
Definition: HelloServer.cpp:11
ostream & operator<<(ostream &s, const MucGeoGap &gap)
Definition: MucGeoGap.cxx:685
void GetSize(float &xSize, float &ySize, float &zSize) const
Get size of this gap.
Definition: MucGeoGap.cxx:310
HepPoint3D CompareIntersection(const int whichhalf, const HepPoint3D gCross1, const HepPoint3D gCross2, const float a, const float b, const float c) const
Definition: MucGeoGap.cxx:559
Hep3Vector RotateToGlobal(const Hep3Vector pVect) const
Rotate a vector from gap coordinate to global coordinate.
Definition: MucGeoGap.cxx:606
Hep3Vector RotateToGap(const Hep3Vector gVect) const
Rotate a vector from global coordinate to gap coordinate.
Definition: MucGeoGap.cxx:613
HepPoint3D TransformToGlobal(const HepPoint3D pPoint) const
Transform a point from gap coordinate to global coordinate.
Definition: MucGeoGap.cxx:620
MucGeoGap()
Default constructor.
Definition: MucGeoGap.cxx:24
int GuessStrip(const float x, const float y, const float z) const
Definition: MucGeoGap.cxx:346
void ProjectToGapSurface(const HepPoint3D gPoint, const Hep3Vector gVect, HepPoint3D &cross1, HepPoint3D &cross2) const
Given a line, find the intersection with two surface of the gap in the global.
Definition: MucGeoGap.cxx:415
HepPoint3D GetCenter() const
Get gap center position in global coordinate.
int Seg() const
Get seg identifier (0-7).
HepPoint3D ProjectToGap(const HepPoint3D gPoint, const Hep3Vector gVect) const
Given a line, find the intersection with the gap in the global.
Definition: MucGeoGap.cxx:379
~MucGeoGap()
Desctructor.
Definition: MucGeoGap.cxx:282
MucGeoStrip * AddStrip(const int strip)
Add a strip to the gap.
Definition: MucGeoGap.cxx:645
int Gap() const
Get gap identifier (0-8).
int Part() const
Get part identifier (0,2 for cap, 1 for barrel).
void GetRotationMatrix(float &thetaX, float &phiX, float &thetaY, float &phiY, float &thetaZ, float &phiZ) const
Get the rotation angles (in degrees) of the gap in global coordinate.
Definition: MucGeoGap.cxx:321
HepPoint3D ProjectToGapWithSigma(const HepPoint3D gPoint, const Hep3Vector gVect, const HepPoint3D gPointSigma, const Hep3Vector gVectSigma, HepPoint3D &gCross, HepPoint3D &gCrossSigma) const
Definition: MucGeoGap.cxx:396
MucGeoGap & operator=(const MucGeoGap &orig)
Assignment constructor.
Definition: MucGeoGap.cxx:223
bool IsInGap(const float x, const float y, const float z) const
Check if the point (given in gap coordinate) is within the gap boundary.
Definition: MucGeoGap.cxx:634
HepPoint3D ProjectToGapQuadLocal(const int part, const int orient, const float a, const float b, const float c, const int whichhalf, HepPoint3D &cross1, HepPoint3D &cross2) const
Definition: MucGeoGap.cxx:435
HepPoint3D TransformToGap(const HepPoint3D gPoint) const
Transform a point from global coordinate to gap coordinate.
Definition: MucGeoGap.cxx:627
MucGeoStrip * GetStrip(const int strip) const
Point to a strip within this gap.
Definition: MucGeoGap.cxx:294
void SetLeftNeighbor(MucGeoStrip *p)
Set pointer to the adjacent strip on the -X or -Y side of this one.
void SetRightNeighbor(MucGeoStrip *p)
Set pointer to the adjacent strip on the +X or +Y side of this one.
void GetCenterPos(float &x, float &y, float &z) const
Get center position of this strip (in the gap coordinate system).
Definition: MucGeoStrip.cxx:40
bool GetIntersectionQuadPlane(const HepPoint3D pLine, const float vy, const float y0, const float a, const float b, const float c, const HepPlane3D plane, HepPoint3D &cross1, HepPoint3D &cross2)
bool GetIntersectionLinePlane(const HepPoint3D pLine, const Hep3Vector vectLine, const HepPlane3D plane, HepPoint3D &cross)
Get intersection of a line and a plane.
bool GetIntersectionQuadPlaneLocal(const int part, const int orient, const float a, const float b, const float c, const HepPlane3D plane, HepPoint3D &cross1, HepPoint3D &cross2)
bool GetIntersectionLinePlaneWithSigma(const HepPoint3D pLine, const Hep3Vector vectLine, const HepPoint3D pLineSigma, const Hep3Vector vectLineSigma, const HepPlane3D plane, HepPoint3D &cross, HepPoint3D &crossSigma)