FairRoot/PandaRoot
PndTrkCTGeometryCalculations.cxx
Go to the documentation of this file.
2 #include "PndTrkMergeSort.h"
3 #include "PndTrkConstants.h"
4 #include <iostream>
5 #include <cmath>
6 #include <math.h>
7 // Root includes
8 #include "TROOT.h"
9 
10 
11 using namespace std;
12 
13 //----------begin of function PndTrkCTGeometryCalculations::CalculateArcLength
14 
16  Double_t Oxx,
17  Double_t Oyy,
18  Double_t Rr,
19  Short_t charge,
20  Double_t *Xcross, // entrance-exit point
21  Double_t *Ycross // entrance-exit point
22  )
23 {
24  Double_t dis,
25  theta1,
26  theta2;
27 
28  theta1 = atan2(Ycross[0]-Oyy, Xcross[0]- Oxx);
29  theta2 = atan2(Ycross[1]-Oyy, Xcross[1]- Oxx);
30 
31 
32  if(charge>0){ // the rotation was clockwise.
33  dis = theta1-theta2;
34  } else { // the rotation was counterclockwise.
35  dis = theta2-theta1;
36  }
37 
38  if(dis<0.) dis += TWO_PI;
39  if(dis<0.) dis =0.;
40 
41  dis *= Rr;
42 
43  return dis;
44 }
45 //----------end of function PndTrkCTGeometryCalculations::CalculateArcLength
46 
47 
48 
49 
50 //----------begin of function PndTrkCTGeometryCalculations::CalculateCircleThru3Points
51 
53  Double_t x1,
54  Double_t y1,
55  Double_t x2,
56  Double_t y2,
57  Double_t x3,
58  Double_t y3,
59  Double_t *o_x,
60  Double_t *o_y,
61  Double_t *r_r
62  )
63 {
64  // inspiration from http://mathworld.wolfram.com/Circle.html
65 
66  Double_t a,
67  d,
68  e,
69  q1,
70  q2,
71  q3;
72 
73  a = x1*y2 + y1*x3 + x2*y3 - x3*y2 - x2*y1 - x1*y3;
74 
75  if( fabs(a)<1.e-10 ) return false;
76 
77  q1 = x1*x1 + y1*y1;
78  q2 = x2*x2 + y2*y2;
79  q3 = x3*x3 + y3*y3;
80 
81  d = -(q1*y2 + y1*q3 + q2*y3 - q3*y2 - q2*y1 - q1*y3);
82 
83  e = -(x1*q2 + q1*x3 + x2*q3 - x3*q2 - x2*q1 - x1*q3);
84 
85  *o_x = -0.5*d/a;
86  *o_y = -0.5*e/a;
87  *r_r = sqrt( (x1-*o_x)*(x1-*o_x) + (y1-*o_y)*(y1-*o_y) );
88 
89 
90  return true;
91 }
92 //----------end of function PndTrkCTGeometryCalculations::CalculateCircleThru3Points
93 
94 
95 
96 
97 //------------------- begin of function PndTrkCTGeometryCalculations::calculateintersections
98 
100  Double_t Oxx,
101  Double_t Oyy,
102  Double_t Rr,
103  Double_t C0x,
104  Double_t C0y,
105  Double_t C0z,
106  Double_t /*r*/, //[R.K. 9/2018] unused
107  Double_t vx,
108  Double_t vy,
109  Double_t vz,
110  Int_t *STATUS,
111  Double_t* POINTS)
112 {
113 
114 
115 //-------------------------------------------
116 
117 
118  //Double_t P1x, P1y, P1z, P2x, P2y, P2z; //[R.K. 01/2017] unused variable?
119 
120  Double_t AAA, DELTA, ax, ay; //, aaa; //[R.K. 01/2017] unused variable?
121 
122 
123 
124 
125 /*
126  INPUTS :
127 
128  Oxx, Oyy = abscissa and ordinate of the center of the circular trajectory of
129  the particle;
130  Rr = radius of such trajectory;
131  C0x, C0y, C0z = x, y, z coordinates of a point belonging to the axis of the
132  skewed straw;
133  r = radius of equidrift of such skewed straw;
134  vx, vy, vz = versor of the direction along which the skewed straw lies.
135 
136 
137  OUTPUTS :
138 
139  P1x, P1y, P1z = x, y, z coordinates of the point intersection between the
140  particle trajectory circle and the equidrift cylinder of
141  the skewed straw calculated as a function of theta (first
142  solution);
143  P2x, P2y, P2z = x, y, z coordinates of the point intersection between the
144  particle trajectory circle and the equidrift cylinder of
145  the skewed straw calculated as a function of theta (second
146  solution);
147 
148  P1x, P1y, .... , P2z are stored in the array POINTS[0-5]; the status is stored
149  in *STATUS.
150 
151 */
152 
153 
154 
155 
156 //--------------------------------------------------------------------------
157 
158 
159 // from the resolving formula on page 23 of Gianluigi's notes, setting r=0.
160 
161 
162  ax = C0x - Oxx;
163  ay = C0y - Oyy;
164  DELTA = Rr*Rr*(vx*vx+vy*vy) - (vx*ay - vy*ax)*(vx*ay - vy*ax);
165  AAA = vx*vx+vy*vy;
166 
167 
168  if ( DELTA < 0. ) {
169  *STATUS=-2;
170  } else if (AAA == 0.){
171  *STATUS=-3;
172  } else if (DELTA == 0.){
173  *STATUS=1;
174  POINTS[0] = C0x - vx*(vx*ax + vy*ay)/AAA;
175  POINTS[1] = C0y - vy*(vx*ax + vy*ay)/AAA;
176  POINTS[2] = C0z - vz*(vx*ax + vy*ay)/AAA;
177  }else {
178  *STATUS=0;
179  DELTA = sqrt(DELTA);
180  POINTS[0] = C0x - vx*(vx*ax + vy*ay - DELTA)/AAA;
181  POINTS[1] = C0y - vy*(vx*ax + vy*ay - DELTA)/AAA;
182  POINTS[2] = C0z - vz*(vx*ax + vy*ay - DELTA)/AAA;
183  POINTS[3] = C0x - vx*(vx*ax + vy*ay + DELTA)/AAA;
184  POINTS[4] = C0y - vy*(vx*ax + vy*ay + DELTA)/AAA;
185  POINTS[5] = C0z - vz*(vx*ax + vy*ay + DELTA)/AAA;
186  }
187 
188  return;
189 
190 
191 }
192 
193 
194 
195 //----------end of function PndTrkCTGeometryCalculations::calculateintersections
196 
197 
198 
199 //------------------------- begin of function PndTrkCTGeometryCalculations::CalculateSandZ
200 
202  Double_t Oxx,
203  Double_t Oyy,
204  Double_t Rr,
205  Short_t skewnum,
206  Double_t info[][7],
207  Double_t *WDX,
208  Double_t *WDY,
209  Double_t *WDZ,
210  Double_t S[2], // output;
211  Double_t Z[2], // output; Zcoordinate of the central wire.
212  Double_t Zdrift[2],// output; drift radius projected onto the Helix.
213  Double_t Zerror[2] // output; 150 micron projected onto the Helix.
214  )
215 {
216 
217  // this method is the same as CalculateSandZ2 only it does NOT return the Sdrift[2] array;
218 
219 
220  Double_t Sdrift[2];
221 
222  CalculateSandZ2(
223  Oxx, // input;
224  Oyy, // input;
225  Rr, // input;
226  skewnum, // input;
227  info, // input;
228  WDX, // input;
229  WDY, // input;
230  WDZ, // input;
231  S, // output;
232  Sdrift, // output; drift radius projected onto the Helix S direction.
233  Z, // output; Zcoordinate of the central wire.
234  Zdrift,// output; drift radius projected onto the Helix Z direction.
235  Zerror // output; 150 micron projected onto the Helix.
236  );
237 
238 }
239 
240 //------------------------- end of function PndTrkCTGeometryCalculations::CalculateSandZ
241 
242 
243 
244 
245 
246 //------------------------- begin of function PndTrkCTGeometryCalculations::CalculateSandZ2
247 
249  Double_t Oxx,
250  Double_t Oyy,
251  Double_t Rr,
252  Short_t skewnum,
253  Double_t info[][7],
254  Double_t *WDX,
255  Double_t *WDY,
256  Double_t *WDZ,
257  Double_t S[2], // output;
258  Double_t Sdrift[2],// output; drift radius projected onto the Helix S direction;
259  Double_t Z[2], // output; Zcoordinate of the central wire.
260  Double_t Zdrift[2],// output; drift radius projected onto the Helix Z direction;
261  Double_t Zerror[2] // output; 150 micron projected onto the Helix.
262  )
263 {
264 
265 
266  Int_t STATUS;
267  Short_t i,
268  j,
269  ii;
270 
271  Double_t
272  aaa,
273  bbb,
274  Bmax,
275  distance,
276  Aellipsis1,
277  Bellipsis1,
278  Rx,
279  Ry,
280  sinDelta,
281  sinTheta,
282  vx1,
283  vy1,
284  vz1,
285  C0x1,
286  C0y1,
287  C0z1,
288  POINTS1[6];
289 
290 
291  // necessary initialization of the intersection position;
292  Z[0]= 999999.;
293  Z[1]= 999999.;
294  i = skewnum ;
295 
296  aaa = sqrt(WDX[i]*WDX[i]+WDY[i]*WDY[i]+ WDZ[i]*WDZ[i]);
297  vx1 = WDX[i]/aaa;
298  vy1 = WDY[i]/aaa;
299  vz1 = WDZ[i]/aaa;
300  C0x1 = info[i][0];
301  C0y1 = info[i][1];
302  C0z1 = info[i][2];
303 
304 
305  calculateintersections(Oxx,Oyy,Rr,C0x1,C0y1,C0z1,info[i][3],
306  vx1,vy1,vz1,
307  &STATUS,POINTS1);
308 
309 
310  if(STATUS < 0 ) return;
311 
312 
313  // loop on the two possible intersections of the middle wire the straw with the
314  // trajectory circle; if that is unphysical then the intersection
315  // remains 999999.
316  for( ii=0; ii<2; ii++){
317  j=3*ii;
318  distance = sqrt(
319  (POINTS1[j]-C0x1)*(POINTS1[j]-C0x1) +
320  (POINTS1[1+j]-C0y1)*(POINTS1[1+j]-C0y1) +
321  (POINTS1[2+j]-C0z1)*(POINTS1[2+j]-C0z1)
322  );
323 
324 
325  Rx = POINTS1[j]-Oxx ; // x component Radial vector of cylinder of trajectory
326  Ry = POINTS1[1+j]-Oyy ; // y direction Radial vector of cylinder of trajectory
327 
328 
329  // the tilt direction of this ellipse is (1,0) when major axis along Z direction
330 
331  sinTheta = vx1*vx1 + vy1*vy1;
332  if( sinTheta < 1.e-10) continue;
333  sinTheta = sqrt(sinTheta);
334  Aellipsis1 = info[i][3]/sinTheta;
335 
336 
337  // Bellipsis1 must be in radians;
338  sinDelta = 1. - (-Ry*vx1 + Rx*vy1)*(-Ry*vx1 + Rx*vy1)/(Rx*Rx+Ry*Ry);
339  // for the derivation of the maximum Bellipsis1 possible see Logbook Panda II on page 109;
340  bbb = info[i][3]*(2.*Rr-info[i][3]);
341  if(bbb< 1.e-10) continue;
342  Bmax = 2.*info[i][3]/sqrt(bbb);
343  if( sinDelta < 1.e-10) Bellipsis1=Bmax;
344  sinDelta = sqrt(sinDelta);
345  Bellipsis1 = info[i][3]/(Rr*sinDelta);
346  if(Bmax<Bellipsis1) Bellipsis1=Bmax;
347 
348  // if the intersection point is unphysical, out of the straw length, quit but set Z[ii] to 1000000.+distance ;
349  if( distance >= info[i][4] + Aellipsis1) {
350  Z[ii] = 1000000.+distance;
351  continue;
352  }
353 
354 //--------------------------
355  S[ii] = atan2(POINTS1[j+1]-Oyy, POINTS1[j]-Oxx) ; // atan2 returns radians in (-pi and +pi]
356  if( S[ii] < 0.) S[ii] += TWO_PI;
357 
358  Sdrift[ii]=Bellipsis1;
359 
360  Z[ii] = POINTS1[j+2];
361  Zdrift[ii] = Aellipsis1;
362  Zerror[ii] = STRAWRESOLUTION/sinTheta;
363 
364 
365 
366 // Double_t rotation1 = 180.*atan2(Tiltdirection1[1],Tiltdirection1[0])/PI;
367 
368 
369  } // end of for( ii=0; ii<2; ii++)
370 
371  return;
372 }
373 
374 //------------------------- end of function PndTrkCTGeometryCalculations::CalculateSandZ2
375 
376 
377 
378 
379 
380 //----------star of function PndTrkCTGeometryCalculations::ChooseEntranceExitbis
382  Double_t Oxx,
383  Double_t Oyy,
384  Short_t Charge,
385  Double_t FiStart,
386  Short_t nIntersections,
387  Double_t *XintersectionList,
388  Double_t *YintersectionList,
389  Double_t Xcross[2], // output
390  Double_t Ycross[2] // output
391  )
392 {
393 
394  Short_t
395  i;
396 
397  PndTrkMergeSort MergeSort;
398 
399 // this method works under the hypothesis that there are at least 2 intersections.
400 // It orders the nIntersections intersections using as order parameter the azimuthal
401 // angle fi (in the reference frame of the trajectory helix); then it returns the FIRST
402 // TWO INTERSECTIONS assuming that the track was originated from (0,0,0) and taking into
403 // account its charge;
404 
405  if (nIntersections<2) return;
406 
407  if(Charge > 0) {
408  Int_t auxIndex[100];
409  Double_t fi[100];
410  for( i=0;i<nIntersections;i++){
411  fi[i] = atan2(YintersectionList[i]-Oyy,
412  XintersectionList[i]-Oxx);
413  if( fi[i] < 0.) fi[i] += TWO_PI;
414  if( fi[i] > FiStart) fi[i] -= TWO_PI;
415  if( fi[i] > FiStart) fi[i] = FiStart;
416  auxIndex[i]=i;
417  } // end of for( i=0;i<nIntersections;i++)
418  MergeSort.Merge_Sort( nIntersections, fi, auxIndex);
419  Xcross[0] = XintersectionList[ auxIndex[nIntersections-1] ];
420  Ycross[0] = YintersectionList[ auxIndex[nIntersections-1] ];
421  Xcross[1] = XintersectionList[ auxIndex[nIntersections-2] ];
422  Ycross[1] = YintersectionList[ auxIndex[nIntersections-2] ];
423 
424  } else { // case in which Charge is negative.
425  Int_t auxIndex[nIntersections];
426  Double_t fi[nIntersections];
427  for( i=0;i<nIntersections;i++){
428  fi[i] = atan2(YintersectionList[i]-Oyy,
429  XintersectionList[i]-Oxx);
430  if( fi[i] < 0.) fi[i] += TWO_PI;
431  if( fi[i] < FiStart) fi[i] += TWO_PI;
432  if( fi[i] < FiStart) fi[i] += FiStart;
433  auxIndex[i]=i;
434  } // end of for( i=0;i<nIntersections;i++)
435  MergeSort.Merge_Sort( nIntersections, fi, auxIndex);
436  Xcross[0] = XintersectionList[ auxIndex[0] ];
437  Ycross[0] = YintersectionList[ auxIndex[0] ];
438  Xcross[1] = XintersectionList[ auxIndex[1] ];
439  Ycross[1] = YintersectionList[ auxIndex[1] ];
440  }
441 
442 
443 
444 
445 }
446 //----------end of function PndTrkCTGeometryCalculations::ChooseEntranceExitbis
447 
448 
449 
450 
451 //----------star of function PndTrkCTGeometryCalculations::ChooseEntranceExit3
453  Double_t Oxx,
454  Double_t Oyy,
455  Short_t Charge,
456  Double_t FiStart, // input; it must be >0.; Fi angle of the starting point
457  // of the trajectory in the Helix reference frame;
458  Short_t nIntersections,
459  Double_t *XintersectionList, // input and output;
460  Double_t *YintersectionList, // input and output;
461  Double_t *FiOrderedList // output
462  )
463 {
464 
465  Short_t
466  i;
467  //j; //[R.K. 01/2017] unused variable?
468 
469  Int_t auxIndex[nIntersections];
470 
471  Double_t auxX[nIntersections], auxY[nIntersections], fi[nIntersections];
472 
473  PndTrkMergeSort MergeSort;
474 
475 // this method works under the hypothesis that there are at least 2 intersections.
476 // It is the same as ChooseEntranceExitbis but it gives in output the values of the ordered
477 // Fi ( in FiOrderedLis);
478 
479  if (nIntersections<2) return;
480 
481  if(Charge > 0) { // charge positive, particle rotates clockwise when looking into the beam;
482  for( i=0;i<nIntersections;i++){
483  fi[i] = atan2(YintersectionList[i]-Oyy,
484  XintersectionList[i]-Oxx);
485  if( fi[i] < 0.) fi[i] += TWO_PI;
486  if( fi[i] > FiStart) fi[i] -= TWO_PI;
487  if( fi[i] > FiStart) fi[i] = FiStart;
488  auxIndex[i]=i;
489  } // end of for( i=0;i<nIntersections;i++)
490  MergeSort.Merge_Sort( nIntersections, fi, auxIndex);
491  for( i=0;i<nIntersections;i++){
492  auxX[i] = XintersectionList[ auxIndex[nIntersections-i-1] ];
493  auxY[i] = YintersectionList[ auxIndex[nIntersections-i-1] ];
494  FiOrderedList[i] = fi[nIntersections-i-1];
495  } // end of for( i=0;i<nIntersections;i++)
496 
497  } else { // case in which charge is negative; particle rotates counterclockwise when looking into the beam;
498  for( i=0;i<nIntersections;i++){
499  fi[i] = atan2(YintersectionList[i]-Oyy,
500  XintersectionList[i]-Oxx);
501  if( fi[i] < 0.) fi[i] += TWO_PI;
502  if( fi[i] < FiStart) fi[i] += TWO_PI;
503  if( fi[i] < FiStart) fi[i] += FiStart;
504  auxIndex[i]=i;
505 
506 
507  } // end of for( i=0;i<nIntersections;i++)
508  MergeSort.Merge_Sort( nIntersections, fi, auxIndex);
509 
510  for( i=0;i<nIntersections;i++){
511  auxX[i] = XintersectionList[ auxIndex[i] ];
512  auxY[i] = YintersectionList[ auxIndex[i] ];
513  FiOrderedList[i] = fi[i] ;
514  } // end of for( i=0;i<nIntersections;i++)
515 
516  } // end of if(Charge > 0)
517 
518 
519  for( i=0;i<nIntersections;i++){
520  XintersectionList[i] = auxX[i];
521  YintersectionList[i] = auxY[i];
522  } // end of for( i=0;i<nIntersections;i++)
523 
524 
525 }
526 //----------end of function PndTrkCTGeometryCalculations::ChooseEntranceExit3
527 
528 
529 
530 
531 //------------------------- begin of function PndTrkCTGeometryCalculations::Dist_SZ
532 
534  Double_t Rr,
535  Double_t KAPPA,
536  Double_t FI0,
537  Double_t ZED,
538  Double_t S,
539  Int_t *nrounds
540  )
541 {
542 
543 // Defining : ZZ = (S-FI0)/KAPPA
544 // this method returns the distance (WITH ITS SIGN ) : ZZ - ZED. Therefore this number
545 // can be negative.
546 // Care is taken to calculate this distance properly taking into
547 // account that we are dealing with the function FI = mod(KAPPA*Z + FI0, 2*3.14).
548 
549 // the limits of an Int_t are : -2147483648 <= n <= 2147483647
550 
551  Double_t aaa,
552  //ABSdis1, //[R.K. 01/2017] unused variable?
553  dis1,
554  dis2,
555  dis_segments;
556  //gap; //[R.K. 01/2017] unused variable?
557 
558  if(fabs(KAPPA) < 1.e-10){
559  return -999999999.;
560  } else if (fabs(KAPPA)>1.e10) {
561  return -ZED;
562  }
563 
564 // gap = fabs(TWO_PI/KAPPA);
565 
566  aaa = (KAPPA*ZED)/TWO_PI;
567  if( aaa<-2147483648.) {
568  *nrounds = -2147483647;
569  } else if (aaa > 2147483647.) {
570  *nrounds = 2147483647;
571  } else {
572  *nrounds = (Int_t) aaa;
573  }
574 
575  dis_segments = TWO_PI*Rr/sqrt(1.+KAPPA*KAPPA*Rr*Rr); // distance between
576  // two consecutive segments
577  // of trajectory.
578 
579  dis1 = fabs( Rr*S -Rr*KAPPA*ZED - Rr*FI0)/sqrt( 1.+KAPPA*KAPPA*Rr*Rr);
580  dis1 = fmod(dis1,dis_segments);
581  dis2 = dis_segments-dis1; if(dis2<0.)dis2=0.;
582 
583 
584  if( dis1 < dis2 )
585  {
586  return dis1;
587  } else {
588  return dis2;
589  }
590 
591 }
592 
593 //------------------------- end of function PndTrkCTGeometryCalculations::Dist_SZ
594 
595 //------------------------- begin of function PndTrkCTGeometryCalculations::Dist_SZ_bis
596 
598  Double_t /*Rr*/, //[R.K. 9/2018] unused// input
599  Double_t KAPPA, // input
600  Double_t FI0, // input
601  Double_t ZED, // input
602  Double_t S, // input
603  Short_t n_allowed_rounds, // input, number of maximum allowed turns. That means that the number of turns
604  // can go from 0 to n_allowed_rounds. It canNOT be negative even when Pz<0 !!!;
605  Double_t signPz, // input, it indicates if the tracks goes forward (Pz>0) or backwords (Pz<0);
606  Double_t & chosenS // output, the S of the point closer to the trajectory and with an
607  // allowed number of roounds;
608  )
609 {
610 
611 
612 
613  Short_t i;
614  //nMax, //[R.K. 01/2017] unused variable?
615  //nMin //[R.K. 01/2017] unused variable?
616 
617 
618  Double_t
619  boundaries[n_allowed_rounds+3],
620  chosenZ,
621  deltaz,
622  dis,
623  dis_new,
624  z_on_trajectory,
625  z2pi;
626 
627  // check that KAPPA is not zero;
628  if( fabs(KAPPA)<1.e-10) {
629  cout<<"PdnTrkCTGeometryCalculations::Dist_SZ_bis KAPPA < 1.e-10, returning dist=999999.\t";
630  return 999999.;
631  }
632 
633  // calculate z2pi, see logbook on page 140 for meaning;
634 
635  // calculate deltaz, see logbook on page 140 for meaning; the following formula is valid for any combination
636  // of KAPPA and signPz;
637  deltaz = TWO_PI/fabs(KAPPA);
638 
639 
640  // all the calculations are shown in Gianluigi's logbook on page 140;
641  // case with Pz > 0, the particle is moving forward;
642 
643  // for the LITTLE SKEW straws the following is not true, the calculation
644  // should be much more conservative; leave it the same as for the long Skew straw for the moment;
645  boundaries[0] = 0.;
646  if(signPz>0){
647  // particle moving forward;
648 
649 
650  // calculate z2pi, see logbook on page 140 for meaning;
651  if(KAPPA>0.) { z2pi = (TWO_PI-FI0)/KAPPA; if(z2pi<0.) z2pi=0.;} else { z2pi = -FI0/KAPPA;}
652 
653  // the intervals relevant for the trajectory in SZ are n_allowed_rounds+2 (logbook page 141);
654  // loading first the limits of the boundaries;
655 
656 // boundaries[n_allowed_rounds+2] = (n_allowed_rounds+1)*deltaz;
657 
658  // the last boundary is the maximum length of the Skew Straw IN Z (NOT the physical length)
659  // and therefore :
660  boundaries[n_allowed_rounds+2] = ZCENTER_STRAIGHT+SEMILENGTH_STRAIGHT;
661  for(i=1; i<n_allowed_rounds+2;i++){
662  boundaries[i]=z2pi+(i-1)*deltaz;
663  } // end of for (i=1; i<n_allowed_rounds+2;i++)
664 
665  dis = 99999999999.;
666  for(i=0; i< n_allowed_rounds+2; i++){
667  z_on_trajectory = (S-FI0+i*TWO_PI)/KAPPA;
668  // don't accept this solution if it is out of the Z range of this
669  // piece of trajectory in SZ; see logbook on page 141;
670  if( z_on_trajectory < boundaries[i] || z_on_trajectory > boundaries[i+1] ) continue;
671  dis_new = fabs(ZED- z_on_trajectory);
672  if(dis_new < dis) {
673  dis = dis_new;
674  chosenZ = z_on_trajectory; // used later to calculate chosenS;
675  }
676  } // end of for(i=0; i< n_allowed_rounds+2; i++)
677 
678  } else { // in this case Pz <0;
679  // particle moving backward;
680 
681  // calculate z2pi, see logbook on page 140 for meaning;
682  if(KAPPA>0.) { z2pi = FI0/KAPPA;} else { z2pi = -(TWO_PI-FI0)/KAPPA; if(z2pi<0.) z2pi=0.;}
683 
684  // the intervals relevant for the trajectory in SZ are n_allowed_rounds+2 (logbook page 143);
685  // loading first the limits of the boundaries;
686 
687 // boundaries[n_allowed_rounds+2] = -(n_allowed_rounds+1)*deltaz;
688 
689  // the last boundary is the minimum length of the Skew Straw IN Z (NOT the physical length)
690  // and therefore :
691  boundaries[n_allowed_rounds+2] = ZCENTER_STRAIGHT-SEMILENGTH_STRAIGHT;
692  for(i=1; i<n_allowed_rounds+2;i++){
693  boundaries[i]=-z2pi-(i-1)*deltaz;
694  } // end of for (i=1; i<n_allowed_rounds+2;i++)
695 
696  dis = 99999999999.;
697  for(i=0; i< n_allowed_rounds+2; i++){
698  z_on_trajectory = (S-FI0+i*TWO_PI)/KAPPA;
699  // don't accept this solution if it is out of the Z range of this
700  // piece of trajectory in SZ; see logbook on page 143;
701  // since here we are with Z < 0, the boundaries are exchanged compared to the
702  // case whe Pz > 0;
703  if( z_on_trajectory > boundaries[i] || z_on_trajectory < boundaries[i+1] ) continue;
704  dis_new = fabs(ZED - z_on_trajectory);
705  if(dis_new < dis) {
706  dis = dis_new;
707  chosenZ = z_on_trajectory; // used later to calculate chosenS;
708  }
709  } // end of for(i=0; i< n_allowed_rounds+2; i++)
710 
711  } // end of if(signPz>0)
712 
713 
714  // calculate the S corresponding to this hit; this S can be < 0. or > 2PI; so it coincides
715  // with the input S only when the number of rounds of this hit are 0;
716  chosenS = FI0 + KAPPA* chosenZ;
717 
718  return dis;
719 }
720 
721 //------------------------- end of function PndTrkCTGeometryCalculations::Dist_SZ_bis
722 
723 
724 
725 //------------------------- begin of function PndTrkCTGeometryCalculations::FindDistance
726 
728  Double_t Oxx, // center from wich distance is calculated
729  Double_t Oyy, // center from wich distance is calculated
730  Double_t Rr,
731  Double_t tanlow,
732  Double_t tanmid,
733  Double_t tanup,
734  Double_t alfa, // intersection circumference parameter
735  Double_t beta, // intersection circumference parameter
736  Double_t gamma // intersection circumference parameter
737  )
738 {
739 
740 
741  Short_t i,
742  n;
743 
744  Double_t Delta,
745  m[3],
746  q,
747  dist,
748  dist1,
749  dist2,
750  //distlow, //[R.K. 01/2017] unused variable?
751  //distmid, //[R.K. 01/2017] unused variable?
752  //distup, //[R.K. 01/2017] unused variable?
753  totaldist,
754  x1,
755  x2,
756  y1,
757  y2;
758 
759 //int nevento=1; //[R.K. 01/2017] unused variable?
760 
761 
762 
763 
764 
765  m[0] = tanlow;
766  m[1] = tanmid;
767  m[2] = tanup;
768 
769  n=0;
770  totaldist=0.;
771 
772 
773  for(i=0;i<3;i++){
774 
775  if( tanlow<999998.) {
776  q = Oyy-m[i]*Oxx;
777  Delta = alfa*alfa + beta*beta*m[i]*m[i] - 4.*gamma*m[i]*m[i] - 4.*q*q + 4.*m[i]*q*alfa +
778  + 2.*alfa*beta*m[i] - 4.*beta*q - 4.*gamma;
779  if( Delta < 0.){
780  dist = -1.;
781  } else if (Delta==0.){
782  x1 = 0.5*(-alfa - 2.*m[i]*q - beta*m[i] )/(1.+m[i]*m[i]);
783  y1 = m[i]*x1+q;
784  dist = fabs( sqrt( (Oxx-x1)*(Oxx-x1) + (Oyy-y1)*(Oyy-y1) ) - Rr);
785  } else {
786  Delta = sqrt(Delta);
787  x1 = 0.5*(-alfa - 2.*m[i]*q - beta*m[i] - Delta)/(1.+m[i]*m[i]);
788  x2 = 0.5*(-alfa - 2.*m[i]*q - beta*m[i] + Delta)/(1.+m[i]*m[i]);
789  y1 = m[i]*x1+q;
790  y2 = m[i]*x2+q;
791  dist1 = fabs( sqrt( (Oxx-x1)*(Oxx-x1) + (Oyy-y1)*(Oyy-y1) ) - Rr);
792  dist2 = fabs( sqrt( (Oxx-x2)*(Oxx-x2) + (Oyy-y2)*(Oyy-y2) ) - Rr);
793  if(dist1<dist2){
794  dist = dist1;
795  } else{
796  dist = dist2;
797  }
798  }
799  } else {
800  Delta = beta*beta - 4.*Oxx*Oxx - 4.*Oxx*alfa - 4.*gamma;
801 
802  if( Delta < 0.){
803  dist = -1.;
804  } else if (Delta==0.){
805  dist = fabs( fabs(Oyy+0.5*beta) - Rr);
806  } else {
807  Delta = sqrt(Delta);
808  y1 = -0.5*beta + Delta/2.;
809  y2 = -0.5*beta - Delta/2.;
810  dist1 = fabs( fabs(Oyy+0.5*beta + Delta/2.) - Rr);
811  dist2 = fabs( fabs(Oyy+0.5*beta - Delta/2.) - Rr);
812  if(dist1<dist2) dist = dist1;
813  else dist = dist2;
814  }
815  }
816 
817  if( dist>-0.5) {
818  totaldist+=dist;
819  n++;
820  }
821 
822 
823  } // end of for(i=0;i<3;i++)
824 
825 
826  if(n!=3) totaldist = -1.;
827  else totaldist = totaldist / n;
828 
829  return totaldist;
830 
831 }
832 
833 
834 
835 //------------------------- end of function PndTrkCTGeometryCalculations::FindDistance
836 
837 
838 
839 //----------start function PndTrkCTGeometryCalculations::FindingParallelTrackAngularRange
840 
842  Double_t oX,
843  Double_t oY,
844  Double_t Rr,
845  Short_t Charge,
846  Double_t *Fi_low_limit,
847  Double_t *Fi_up_limit,
848  Short_t * status,
849  Double_t Rmi, // Rmin of cylindrical volume intersected by track;
850  Double_t Rma // Rmax of cylindrical volume intersected by track;
851  )
852 {
853 // -------------- calculate the maximum fi and minimum fi spanned by this track,
854 
855 // see logbook pag.270; by using the Rmin and Rmax of the straw detector.
856 // this function works also when circular trajectory in XY doesn't pass through (0,0).
857 
858  bool intersection_inner,
859  intersection_outer;
860  Double_t //teta1, //[R.K. 01/2017] unused variable?
861  //teta2, //[R.K. 01/2017] unused variable?
862  //tetavertex, //[R.K. 01/2017] unused variable?
863  a,
864  //cosT, //[R.K. 01/2017] unused variable?
865  //cost, //[R.K. 01/2017] unused variable?
866  cosFi,
867  cosfi,
868  Fi,
869  fi,
870  FI0;
871  //Px, //[R.K. 01/2017] unused variable?
872  //Py, //[R.K. 01/2017] unused variable?
873  //tmp; //[R.K. 01/2017] unused variable?
874 
875 
876  Rma += 1. ; // add a safety margin.
877  Rmi -= 1. ; // add a safety margin.
878 
879 
880 
881 
882  a = sqrt(oX*oX+oY*oY);
883 
884  // preliminary condition
885  if(a + Rr <= Rmi ) // in this case there might be hits at radius < Rmi.
886  { *status = -1 ;return;}
887  if( a >= Rr + Rma || Rr >= a + Rma) // in this case there can be no hits with radius < Rma.
888  { *status = -2;return;}
889 
890  if( a - Rr >= Rmi ) intersection_inner = false; else intersection_inner = true;
891 
892  if( a + Rr <= Rma || a - Rr >= Rma )
893  intersection_outer = false; else intersection_outer = true;
894 
895  if( (! intersection_inner) && (! intersection_outer) ){
896  *Fi_low_limit = 0.;
897  *Fi_up_limit = TWO_PI;
898  *status = 1;
899  return;
900  }
901 
902 // now the calculation
903 
904  FI0 = atan2(-oY,-oX);
905  if( intersection_outer ){
906  cosFi = (a*a + Rr*Rr - Rma*Rma)/(2.*Rr*a);
907  if(cosFi<-1.) cosFi=-1.; else if(cosFi>1.) cosFi=1.;
908  Fi = acos(cosFi);
909  }
910 
911  if( intersection_inner ){
912  cosfi = (a*a + Rr*Rr - Rmi*Rmi)/(2.*Rr*a);
913  if(cosfi<-1.) cosfi=-1.; else if(cosfi>1.) cosfi=1.;
914  fi = acos(cosfi);
915  }
916 
917  if( Charge < 0){ // this particle rotates counterclockwise when looking into the beam
918  if( intersection_outer && intersection_inner){
919  *Fi_low_limit=FI0 + fi;
920  *Fi_up_limit= FI0 +Fi;
921 
922  } else if (intersection_inner) {
923  *Fi_low_limit=FI0 + fi;
924  *Fi_up_limit= FI0 - fi;
925  } else { // case with intersection_outer=true; intersection_inner=false;
926  *Fi_low_limit=FI0 - Fi;
927  *Fi_up_limit= FI0 + Fi;
928  } // end of if( intersection_outer && intersection_inner
929 
930 
931 
932  } else { // continuation of if( Charge < 0.)
933 
934  if( intersection_outer && intersection_inner){
935  *Fi_low_limit=FI0 - Fi;
936  *Fi_up_limit= FI0 - fi;
937 
938  } else if (intersection_inner) {
939  *Fi_low_limit=FI0 + fi; // must invert because low limit must be < up limit
940  *Fi_up_limit= FI0 - fi;
941  } else { // case with intersection_outer=true; intersection_inner=false;
942  *Fi_low_limit=FI0 - Fi;
943  *Fi_up_limit= FI0 + Fi;
944  } // end of if( intersection_outer && intersection_inner
945 
946 
947  } // end of if( Charge < 0.)
948 
949 
950  if(*Fi_low_limit<0.) {
951  *Fi_low_limit=fmod(*Fi_low_limit,TWO_PI);
952  *Fi_low_limit += TWO_PI;
953  } else if (*Fi_low_limit>=TWO_PI){
954  *Fi_low_limit=fmod(*Fi_low_limit,TWO_PI);
955  }
956  if(*Fi_up_limit<0.) {
957  *Fi_up_limit=fmod(*Fi_up_limit,TWO_PI);
958  *Fi_up_limit += TWO_PI;
959  } else if (*Fi_up_limit>=TWO_PI){
960  *Fi_up_limit=fmod(*Fi_up_limit,TWO_PI);
961  }
962 
963  // Modify *Fi_up_limit by adding
964  // 2PI if it is the case, in order to make *Fi_up_limit > *Fi_low_limit.
965  if( *Fi_up_limit < *Fi_low_limit ) *Fi_up_limit += TWO_PI;
966  if( *Fi_up_limit < *Fi_low_limit ) *Fi_up_limit = *Fi_low_limit;
967 
968 
969 
970  return;
971 }
972 
973 
974 //---------- end of function PndTrkCTGeometryCalculations::FindingParallelTrackAngularRange
975 
976 
977 
978 
979 //----------start function PndTrkCTGeometryCalculations::FindingParallelTrackAngularRange2
980 
982  Double_t oX, // input;
983  Double_t oY, // input;
984  Double_t Rma, // Rmax of cylindrical volume intersected by track;
985  Double_t Rmi, // Rmin of cylindrical volume intersected by track;
986  Double_t Rr, // input; radius of trajectory;
987  Double_t Fi_low_limit[2], // output; Fi (in XY Helix frame) lower limit using
988  // the Stt detector minimum/maximum radius
989  // Fi_low_limit is ALWAYS between 0. and 2PI;
990  Double_t Fi_up_limit[2], // output; Fi (in XY Helix frame) upper limit using
991  // the Stt detector maximum/minimum radius
992  // Fi_up_limit is ALWAYS > Fi_low_limit and
993  // possibly > 2PI;
994  Short_t * status // output;
995  )
996 {
997 // -------------- calculate the maximum fi and minimum fi spanned by this track,
998 
999 // see logbook pag.270; by using the Rmin and Rmax of the straw detector.
1000 // this function works also when circular trajectory in XY doesn't pass through (0,0).
1001 
1002  bool intersection_inner,
1003  intersection_outer;
1004  Double_t //teta1, //[R.K. 01/2017] unused variable?
1005  //teta2, //[R.K. 01/2017] unused variable?
1006  //tetavertex, //[R.K. 01/2017] unused variable?
1007  a,
1008  //cosT, //[R.K. 01/2017] unused variable?
1009  //cost, //[R.K. 01/2017] unused variable?
1010  cosFi,
1011  cosfi,
1012  Fi,
1013  fi,
1014  FI0;
1015  //Px, //[R.K. 01/2017] unused variable?
1016  //Py, //[R.K. 01/2017] unused variable?
1017  //tmp; //[R.K. 01/2017] unused variable?
1018 
1019 
1020  // Fi_low_limit is an array of dimensionality 2;
1021  // Fi_up_limit is an array of dimensionality 2;
1022  // Fi_low_limit[0], Fi_up_limit[0] is the solution (radians) corresponding to the intersection
1023  // on the RIGHT side, in the XY projection of the trajectory [looking into the beam] with respect
1024  // to the segment joining the Center of the Helix with the origin (0,0);
1025  // Fi_low_limit[1], Fi_up_limit[1] is the solution corresponding to the LEFT intersection; in case
1026  // there is no second solution it is set at -100.;
1027  // the charge is not considered here; the two solution are just determined by the intersection of the trajectory
1028  // circle with the inner and outer boundary of the STT detector system;
1029 
1030  // the trajectory NEEDS NOT to come from the origin ;
1031 
1032  // Fi_low_limit is ALWAY between 0 and 2PI radians;
1033  // Fi_up_limit is ALWAYS bigger than Fi_low_limit (not necessarily < 2PI), in radians;
1034 
1035  Rma += 1. ; // add a safety margin.
1036  Rmi -= 1. ; // add a safety margin.
1037 
1038  a = sqrt(oX*oX+oY*oY);
1039 
1040  // preliminary condition
1041  if(a + Rr <= Rmi ) // in this case there might be hits at radius < Rmi.
1042  { *status = -1 ;return;}
1043  if( a >= Rr + Rma || Rr >= a + Rma) // in this case there can be no hits with radius < Rma.
1044  { *status = -2;return;}
1045 
1046  if( a - Rr >= Rmi ) intersection_inner = false; else intersection_inner = true;
1047 
1048  if( a + Rr <= Rma || a - Rr >= Rma )
1049  intersection_outer = false; else intersection_outer = true;
1050 
1051  if( (! intersection_inner) && (! intersection_outer) ){
1052  // in this case the trajectory is contained completely between the inner
1053  // and outer regions of the STT;
1054  Fi_low_limit[0] = 0.;
1055  Fi_up_limit[0] = TWO_PI;
1056  *status = 1;
1057  return;
1058  }
1059 
1060 // now the calculation
1061 
1062  FI0 = atan2(-oY,-oX);
1063  if( intersection_outer ){
1064  cosFi = (a*a + Rr*Rr - Rma*Rma)/(2.*Rr*a);
1065  if(cosFi<-1.) cosFi=-1.; else if(cosFi>1.) cosFi=1.;
1066  Fi = acos(cosFi);
1067  }
1068 
1069  if( intersection_inner ){
1070  cosfi = (a*a + Rr*Rr - Rmi*Rmi)/(2.*Rr*a);
1071  if(cosfi<-1.) cosfi=-1.; else if(cosfi>1.) cosfi=1.;
1072  fi = acos(cosfi);
1073  }
1074 
1075  if( intersection_outer && intersection_inner){
1076 
1077  Fi_low_limit[1] = FI0 - Fi;
1078  Fi_up_limit[1] = FI0 - fi;
1079 
1080  Fi_low_limit[0] = FI0 + fi;
1081  Fi_up_limit[0] = FI0 + Fi;
1082 
1083  } else if (intersection_inner) {
1084  Fi_low_limit[0] = FI0 + fi;
1085  Fi_up_limit[0] = FI0 - fi;
1086 
1087  Fi_low_limit[1] = -100.;
1088  Fi_up_limit[1] = -100.;
1089  } else { // case with intersection_outer=true; intersection_inner=false;
1090  Fi_low_limit[0]=FI0 - Fi;
1091  Fi_up_limit[0]= FI0 + Fi;
1092 
1093  Fi_low_limit[1] = -100.;
1094  Fi_up_limit[1] = -100.;
1095  } // end of if( intersection_outer && intersection_inner
1096 
1097  for(int i=0; i<2; i++){
1098  if( Fi_low_limit[i]<-99.) continue;
1099  if(Fi_low_limit[i]<0.) {
1100  Fi_low_limit[i]=fmod(Fi_low_limit[i],TWO_PI);
1101  Fi_low_limit[i] += TWO_PI;
1102  } else if (Fi_low_limit[i]>=TWO_PI){
1103  Fi_low_limit[i]=fmod(Fi_low_limit[i],TWO_PI);
1104  }
1105  if(Fi_up_limit[i]<0.) {
1106  Fi_up_limit[i]=fmod(Fi_up_limit[i],TWO_PI);
1107  Fi_up_limit[i] += TWO_PI;
1108  } else if (Fi_up_limit[i]>=TWO_PI){
1109  Fi_up_limit[i]=fmod(Fi_up_limit[i],TWO_PI);
1110  }
1111 
1112  // Modify *Fi_up_limit by adding
1113  // 2PI if it is the case, in order to make *Fi_up_limit > *Fi_low_limit.
1114  if( Fi_up_limit[i] < Fi_low_limit[i] ) Fi_up_limit[i] += TWO_PI;
1115  if( Fi_up_limit[i] < Fi_low_limit[i] ) Fi_up_limit[i] = Fi_low_limit[i];
1116  } // end of for(int i=0; i<2; i++)
1117  *status = 0;
1118 
1119 
1120 
1121 
1122  return;
1123 }
1124 
1125 
1126 //---------- end of function PndTrkCTGeometryCalculations::FindingParallelTrackAngularRange2
1127 
1128 
1129 //----------begin of function PndTrkCTGeometryCalculations::FindIntersectionsOuterCircle
1130 
1132  Double_t oX,
1133  Double_t oY,
1134  Double_t Rr, // radius of the trajectory intersecting originating from the vertex at (0,0)
1135  // intersecting with the circle centered at (0,0);
1136  Double_t Rma, // radius of the circle centered at (0,0);
1137  Double_t Xcross[2],
1138  Double_t Ycross[2]
1139  )
1140 {
1141 
1142  // return -1 --> non-intersection;
1143  // return 0 --> 2 intersections.
1144 
1145  Double_t a,
1146  cosFi,
1147  Fi,
1148  FI0;
1149  a = sqrt(oX*oX+oY*oY);
1150 
1151  // case with no intersections or just 1 intersection;
1152  if( a >= Rr + Rma || Rr >= a + Rma || a + Rr <= Rma) return -1;
1153 
1154 
1155  FI0 = atan2(-oY,-oX);
1156  cosFi = (a*a + Rr*Rr - Rma*Rma)/(2.*Rr*a);
1157  if(cosFi<-1.) cosFi=-1.; else if(cosFi>1.) cosFi=1.;
1158  Fi = acos(cosFi);
1159 
1160  Xcross[0] = oX + Rr*cos(FI0+Fi);
1161  Ycross[0] = oY + Rr*sin(FI0+Fi);
1162  Xcross[1] = oX + Rr*cos(FI0-Fi);
1163  Ycross[1] = oY + Rr*sin(FI0-Fi);
1164 
1165  return 0;
1166 }
1167 //----------end of function PndTrkCTGeometryCalculations::FindIntersectionsOuterCircle
1168 
1169 
1170 //----------begin of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonLeft
1171 
1173  Double_t vgap,
1174  Double_t Oxx,
1175  Double_t Oyy,
1176  Double_t Rr,
1177  Short_t Charge,
1178  Double_t Start[3],
1179  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1180  Double_t ApotemaMax,
1181  Double_t Xcross[2],
1182  Double_t Ycross[2]
1183  )
1184 {
1185  Short_t flag;
1186  Short_t nIntersections;
1187  Double_t FiStart,
1188  XintersectionList[16], // all the possible intersections
1189  YintersectionList[16]; // (up to 16 intersections).
1190 
1191 // The following is the form of the Left (looking from downstream into the beam) biHexagon
1192 // geometrical shape considered in this method :
1193 //
1194 /*
1195 
1196  /|
1197  / |
1198  / |
1199  / /
1200  / /
1201  / /
1202  / /
1203  | |
1204  | |
1205  | |
1206  | |
1207  \ \
1208  \ \
1209  \ \
1210  \ \
1211  \ |
1212  \ |
1213  \|
1214 
1215 */
1216 // finding all possible intersections with inner parallel straw region.
1217 // The inner parallel straw region is delimited by two hexagons.
1218 
1219  // flag meaning :
1220  // -1 --> track outside outer perimeter;
1221  // 0 --> at least 1 intersection with polygon, therefore a possible entry and an exit;
1222  // 1 --> track contained completely between the two polygons;
1223 
1224 
1225  flag=IntersectionsWithClosedbiHexagonLeft(
1226  vgap,
1227  Oxx,
1228  Oyy,
1229  Rr,
1230  ApotemaMin, // Apotema of the inner Hexagon,
1231  ApotemaMax,// Apotema of the outer Hexagon.
1232  &nIntersections,
1233  XintersectionList, // XintersectionList[..][0] --> inner polygon,
1234  // XintersectionList[..][1] --> outer polygon.
1235  YintersectionList
1236  );
1237 
1238  // IMPORTANT :
1239  // this is true because here it is assumed that the track comes from (0,0,0)
1240  // otherwise the code must be changed!
1241 
1242  if (!(flag == 0)) return flag;
1243  if( nIntersections<2) return -1;
1244 
1245 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
1246 // and the exit point (Xcross[1], Ycross[1]) of this track.
1247 
1248 //-------- the starting point of the track.
1249  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
1250  if(FiStart<0.) FiStart+= TWO_PI;
1251  if(FiStart<0.) FiStart =0.;
1252 
1253  // this method selects the entrance and exit points of the trajectory among all
1254  // geometrical intersections of the circular trajectory with the straw particular
1255  // volume.
1256 
1257  // so at this point, the intersections are at least 2.
1258 
1259  ChooseEntranceExitbis(
1260  Oxx,
1261  Oyy,
1262  Charge,
1263  FiStart,
1264  nIntersections,
1265  XintersectionList,
1266  YintersectionList,
1267  Xcross, // output
1268  Ycross // output
1269  );
1270 
1271 
1272 //----------------------
1273 
1274  return flag;
1275 
1276 }
1277 
1278 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonLeft
1279 
1280 
1281 
1282 
1283 //----------begin of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonLeft2
1284 
1286  Double_t vgap,
1287  Double_t Oxx,
1288  Double_t Oyy,
1289  Double_t Rr,
1290  Short_t Charge,
1291  Double_t Start[3],
1292  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1293  Double_t ApotemaMax,
1294  Double_t XintersectionList[16],
1295  Double_t YintersectionList[16],
1296  Double_t FiOrderedList[16]
1297  )
1298 {
1299  Short_t flag,
1300  nIntersections;
1301  Double_t FiStart;
1302 
1303 // The following is the form of the Left (looking from downstream into the beam) biHexagon
1304 // geometrical shape considered in this method :
1305 //
1306 
1307 
1308 // /| //
1309 // / | //
1310 // / | //
1311 // / / //
1312 // / / //
1313 // / / //
1314 // / / //
1315 // | | //
1316 // | | //
1317 // | | //
1318 // | | //
1319 // \ \ //
1320 // \ \ //
1321 // \ \ //
1322 // \ \ //
1323 // \ | //
1324 // \ | //
1325 // \| //
1326 
1327 
1328 // finding all possible intersections with inner parallel straw region.
1329 // The inner parallel straw region is delimited by two hexagons.
1330 
1331  // flag meaning :
1332  // -1 --> track outside outer perimeter;
1333  // 0 --> at least 1 intersection with polygon, therefore a possible entry and an exit;
1334  // 1 --> track contained completely between the two polygons;
1335 
1336  // nIntersections is the number of intersections found;
1337 
1338 // This method return nIntersections (it can be 0);
1339 
1340 
1341 
1342  flag=IntersectionsWithClosedbiHexagonLeft(
1343  vgap,
1344  Oxx,
1345  Oyy,
1346  Rr,
1347  ApotemaMin, // Apotema of the inner Hexagon,
1348  ApotemaMax,// Apotema of the outer Hexagon.
1349  &nIntersections,
1350  XintersectionList, // XintersectionList[..][0] --> inner polygon,
1351  // XintersectionList[..][1] --> outer polygon.
1352  YintersectionList
1353  );
1354 
1355  // IMPORTANT :
1356  // this is true because here it is assumed that the track comes from (0,0,0)
1357  // otherwise the code must be changed!
1358 
1359  if (!(flag == 0)) return 0;
1360 
1361 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
1362 // and the exit point (Xcross[1], Ycross[1]) of this track.
1363 
1364 //-------- the starting point of the track.
1365  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
1366  if(FiStart<0.) FiStart+= TWO_PI;
1367  if(FiStart<0.) FiStart =0.;
1368 
1369  // this method selects the entrance and exit points of the trajectory among all
1370  // geometrical intersections of the circular trajectory with the straw particular
1371  // volume.
1372 
1373  // so at this point, the intersections are at least 2.
1374 
1375 
1376  // XintersectionList and YintersectionList are ordered clockwise or counterclockwise
1377  // according to the charge;
1378  ChooseEntranceExit3(
1379  Oxx,
1380  Oyy,
1381  Charge,
1382  FiStart,
1383  nIntersections,
1384  XintersectionList, // input and output;
1385  YintersectionList, // input and output;
1386  FiOrderedList
1387  );
1388 
1389 
1390 //----------------------
1391 
1392  return nIntersections;
1393 
1394 }
1395 
1396 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonLeft2
1397 
1398 
1399 //----------begin of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonRight
1400 
1402  Double_t vgap,
1403  Double_t Oxx,
1404  Double_t Oyy,
1405  Double_t Rr,
1406  Short_t Charge,
1407  Double_t Start[3],
1408  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1409  Double_t ApotemaMax,
1410  Double_t Xcross[2],
1411  Double_t Ycross[2]
1412  )
1413 {
1414  Short_t flag;
1415  Short_t nIntersections;
1416  Double_t FiStart,
1417  XintersectionList[16], // all the possible intersections
1418  YintersectionList[16]; // (up to 16 intersections).
1419 
1420 // The following is the form of the Left (looking from downstream into the beam) biHexagon
1421 // geometrical shape considered in this method :
1422 //
1423 //
1424 // |\ //
1425 // | \ //
1426 // | \ //
1427 // \ \ //
1428 // \ \ //
1429 // | | //
1430 // | | //
1431 // / / //
1432 // / / //
1433 // / / //
1434 // | / //
1435 // | / //
1436 // |/ //
1437 //
1438 
1439 // finding all possible intersections with inner parallel straw region.
1440 // The inner parallel straw region is delimited by two hexagons.
1441 
1442  // flag meaning :
1443  // -1 --> track outside outer perimeter;
1444  // 0 --> at least 1 intersection with polygon, therefore a possible entry and an exit;
1445  // 1 --> track contained completely between the two polygons;
1446 
1447 
1448  flag=IntersectionsWithClosedbiHexagonRight(
1449  vgap,
1450  Oxx,
1451  Oyy,
1452  Rr,
1453  ApotemaMin, // Apotema of the inner Hexagon,
1454  ApotemaMax,// Apotema of the outer Hexagon.
1455  &nIntersections,
1456  XintersectionList,
1457  YintersectionList
1458  );
1459 
1460 
1461 
1462 
1463  // IMPORTANT :
1464  // this is true because here it is assumed that the track comes from (0,0,0)
1465  // otherwise the code must be changed!
1466 
1467  if (!(flag == 0)) return flag;
1468  if( nIntersections<2) return -1;
1469 
1470 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
1471 // and the exit point (Xcross[1], Ycross[1]) of this track.
1472 
1473 //-------- the starting point of the track.
1474  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
1475  if(FiStart<0.) FiStart+= TWO_PI;
1476  if(FiStart<0.) FiStart =0.;
1477 
1478  // this method selects the entrance and exit points of the trajectory among all
1479  // geometrical intersections of the circular trajectory with the straw particular
1480  // volume.
1481 
1482  // so at this point, the intersections are at least 2.
1483 
1484  ChooseEntranceExitbis(
1485  Oxx,
1486  Oyy,
1487  Charge,
1488  FiStart,
1489  nIntersections,
1490  XintersectionList,
1491  YintersectionList,
1492  Xcross, // output
1493  Ycross // output
1494  );
1495 
1496 
1497 //----------------------
1498 
1499  return flag;
1500 
1501 }
1502 
1503 
1504 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonRight
1505 
1506 
1507 
1508 //----------begin of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonRight2
1509 
1511  Double_t vgap,
1512  Double_t Oxx,
1513  Double_t Oyy,
1514  Double_t Rr,
1515  Short_t Charge,
1516  Double_t Start[3],
1517  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1518  Double_t ApotemaMax,
1519  Double_t XintersectionList[16],
1520  Double_t YintersectionList[16],
1521  Double_t FiOrderedList[16]
1522  )
1523 {
1524  Short_t flag,
1525  nIntersections;
1526 
1527  Double_t FiStart;
1528 
1529 // The following is the form of the Left (looking from downstream into the beam) biHexagon
1530 // geometrical shape considered in this method :
1531 //
1532 //
1533 // |\ //
1534 // | \ //
1535 // | \ //
1536 // \ \ //
1537 // \ \ //
1538 // | | //
1539 // | | //
1540 // / / //
1541 // / / //
1542 // / / //
1543 // | / //
1544 // | / //
1545 // |/ //
1546 //
1547 
1548 // finding all possible intersections with inner parallel straw region.
1549 // The inner parallel straw region is delimited by two hexagons.
1550 
1551  // flag meaning :
1552  // -1 --> track outside outer perimeter;
1553  // 0 --> at least 1 intersection with polygon, therefore a possible entry and an exit;
1554  // 1 --> track contained completely between the two polygons;
1555 
1556 
1557 // This method returns the number of intersections (it can be 0);
1558 
1559 
1560 
1561  flag=IntersectionsWithClosedbiHexagonRight(
1562  vgap,
1563  Oxx,
1564  Oyy,
1565  Rr,
1566  ApotemaMin, // Apotema of the inner Hexagon,
1567  ApotemaMax,// Apotema of the outer Hexagon.
1568  &nIntersections,
1569  XintersectionList,
1570  YintersectionList
1571  );
1572 
1573 
1574  // IMPORTANT :
1575  // this is true because here it is assumed that the track comes from (0,0,0)
1576  // otherwise the code must be changed!
1577 
1578  if (!(flag == 0)) return 0;
1579 
1580 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
1581 // and the exit point (Xcross[1], Ycross[1]) of this track.
1582 
1583 //-------- the starting point of the track.
1584  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
1585  if(FiStart<0.) FiStart+= TWO_PI;
1586  if(FiStart<0.) FiStart =0.;
1587 
1588  // this method selects the entrance and exit points of the trajectory among all
1589  // geometrical intersections of the circular trajectory with the straw particular
1590  // volume.
1591 
1592  // so at this point, the intersections are at least 2.
1593 
1594  // XintersectionList and YintersectionList are ordered clockwise or counterclockwise
1595  // according to the charge;
1596  ChooseEntranceExit3(
1597  Oxx,
1598  Oyy,
1599  Charge,
1600  FiStart,
1601  nIntersections,
1602  XintersectionList, // input and output;
1603  YintersectionList, // input and output;
1604  FiOrderedList // output;
1605  );
1606 
1607 
1608 //----------------------
1609 
1610  return nIntersections;
1611 
1612 }
1613 
1614 
1615 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitbiHexagonRight2
1616 
1617 
1618 //----------begin function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleLeft
1619 
1621  Double_t Oxx,
1622  Double_t Oyy,
1623  Double_t Rr,
1624  Short_t Charge,
1625  Double_t Start[3],
1626  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1627  Double_t Rma, // outer radius of the Circle.
1628  Double_t GAP, // gap between left and right sections of STT;
1629  Double_t Xcross[2],
1630  Double_t Ycross[2]
1631  )
1632 {
1633 
1634 // This methods finds the intersections between a trajectory coming from (0,0) and
1635 // parameters Oxx, Oyy, Rr with the closed geometrical figure (in XY) formed by the STT
1636 // external Left semicircle and the Outer STT parallel Left straw semi-Hexagon + Gap for
1637 // the pellet target target.
1638 // It returns -1 if there are 0 or 1 intersections, or it returns 0
1639 // if they are at least 2.
1640 
1641 
1642 //------------------
1643 
1644  Short_t nIntersectionsCircle,
1645  nIntersections;
1646  Double_t FiStart,
1647  XintersectionList[12],
1648  YintersectionList[12]; // all the possible intersections (up to 12 intersections).
1649 
1650 // finding all possible intersections with inner parallel straw region.
1651 
1652 
1653  Double_t Side_x[] = { -GAP/2., -GAP/2. , -ApotemaMin, -ApotemaMin, -GAP/2., -GAP/2. },
1654  Side_y[] = { sqrt(Rma*Rma-GAP*GAP/4.), (2.*ApotemaMin-GAP/2.)/sqrt(3.),
1655  ApotemaMin/sqrt(3.),
1656  -ApotemaMin/sqrt(3.),
1657  -(2.*ApotemaMin-GAP/2.)/sqrt(3.), -sqrt(Rma*Rma-GAP*GAP/4.)},
1658  a[] = {1., -1./sqrt(3.), 1., 1./sqrt(3.), 1.},
1659  b[] = {0., 1., 0., 1., 0.},
1660  c[] = {GAP/2., -2.*ApotemaMin/sqrt(3.),ApotemaMin, 2.*ApotemaMin/sqrt(3.), GAP/2.};
1661 
1662  nIntersections=IntersectionsWithOpenPolygon(
1663  Oxx,
1664  Oyy,
1665  Rr,
1666  5, // n. Sides of open Polygon.
1667  a, // coefficient of formula : aX + bY + c = 0 defining the Polygon sides.
1668  b,
1669  c,
1670  Side_x, // X,Y coordinate of the Sides vertices (in sequence, following
1671  Side_y, // the Polygon along.
1672  XintersectionList, // XintersectionList
1673  YintersectionList // YintersectionList.
1674  );
1675 
1676 
1677 
1678 
1679 //-------------------------------------------------------------------------
1680 // finding intersections of trajectory [assumed to originate from (0,0) ]
1681 // with outer semicircle, the Left part.
1682 
1683  nIntersectionsCircle=IntersectionsWithGapSemicircle(
1684  Oxx, // input from trajectory
1685  Oyy, // input from trajectory
1686  Rr, // input from trajectory
1687  GAP, // input, vertical gap in XY plane of STT detector.
1688  true, // true --> Left semicircle, false --> Right semicircle.
1689  Rma, // radius of external Stt containment.
1690  &XintersectionList[nIntersections], // output, X list of intersections (maximal 2).
1691  &YintersectionList[nIntersections]
1692  );
1693  nIntersections += nIntersectionsCircle;
1694 
1695 //-------- the starting point of the track.
1696 
1697  if(nIntersections<2) return -1;
1698 
1699  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
1700  if(FiStart<0.) FiStart+= TWO_PI;
1701  if(FiStart<0.) FiStart =0.;
1702 
1703  // this method selects the entrance and exit points of the trajectory among all
1704  // geometrical intersections of the circular trajectory with the straw particular
1705  // volume.
1706 
1707 
1708  ChooseEntranceExitbis(
1709  Oxx,
1710  Oyy,
1711  Charge,
1712  FiStart,
1713  nIntersections,
1714  XintersectionList,
1715  YintersectionList,
1716  Xcross, // output
1717  Ycross // output
1718  );
1719 
1720 
1721  return 0;
1722 
1723 }
1724 
1725 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleLeft
1726 
1727 
1728 
1729 //----------begin function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleLeft2
1730 
1732  Double_t Oxx,
1733  Double_t Oyy,
1734  Double_t Rr,
1735  Short_t Charge,
1736  Double_t Start[3],
1737  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1738  Double_t Rma, // outer radius of the Circle.
1739  Double_t GAP, // gap between left and right sections of STT;
1740  Double_t XintersectionList[12],
1741  Double_t YintersectionList[12],
1742  Double_t FiOrderedList[12]
1743  )
1744 {
1745 
1746 // THIS METHOD IS THE SAME AS FindTrackEntranceExitHexagonCircleLeft BUT IT PROVIDES ALL THE
1747 // INTERSECTIONS ORDERED FROM CENTER TO PERIFERY;
1748 // This methods finds the intersections between a trajectory coming from (0,0) and
1749 // parameters Oxx, Oyy, Rr with the closed geometrical figure (in XY) formed by the STT
1750 // external Left semicircle and the Outer STT parallel Left straw semi-Hexagon + Gap for
1751 // the pellet target target.
1752 // It returns the number of intersections (0 in case).
1753 
1754 // At the most the number of such intersection is 12, that's why XintersectionList[12];
1755 // also the intersections are ordered from center to perifery according to the charge of the
1756 // track that dictates the sense of rotation;
1757 
1758  Short_t nIntersections;
1759 
1760 //------------------
1761 
1762  Short_t nIntersectionsCircle;
1763 
1764  Double_t FiStart;
1765 
1766 
1767 
1768 // This method returns the number of intersections (it can be 0);
1769 
1770 
1771 
1772 
1773 // finding all possible intersections with inner parallel straw region.
1774 
1775 
1776  Double_t Side_x[] = { -GAP/2., -GAP/2. , -ApotemaMin, -ApotemaMin, -GAP/2., -GAP/2. },
1777  Side_y[] = { sqrt(Rma*Rma-GAP*GAP/4.), (2.*ApotemaMin-GAP/2.)/sqrt(3.),
1778  ApotemaMin/sqrt(3.),
1779  -ApotemaMin/sqrt(3.),
1780  -(2.*ApotemaMin-GAP/2.)/sqrt(3.), -sqrt(Rma*Rma-GAP*GAP/4.)},
1781  a[] = {1., -1./sqrt(3.), 1., 1./sqrt(3.), 1.},
1782  b[] = {0., 1., 0., 1., 0.},
1783  c[] = {GAP/2., -2.*ApotemaMin/sqrt(3.),ApotemaMin, 2.*ApotemaMin/sqrt(3.), GAP/2.};
1784 
1785  nIntersections=IntersectionsWithOpenPolygon(
1786  Oxx,
1787  Oyy,
1788  Rr,
1789  5, // n. Sides of open Polygon.
1790  a, // coefficient of formula : aX + bY + c = 0 defining the Polygon sides.
1791  b,
1792  c,
1793  Side_x, // X,Y coordinate of the Sides vertices (in sequence, following
1794  Side_y, // the Polygon along.
1795  XintersectionList, // XintersectionList
1796  YintersectionList // YintersectionList.
1797  );
1798 
1799 
1800 
1801 //-------------------------------------------------------------------------
1802 // finding intersections of trajectory [assumed to originate from (0,0) ]
1803 // with outer semicircle, the Left part.
1804 
1805  nIntersectionsCircle=IntersectionsWithGapSemicircle(
1806  Oxx, // input from trajectory
1807  Oyy, // input from trajectory
1808  Rr, // input from trajectory
1809  GAP, // input, vertical gap in XY plane of STT detector.
1810  true, // true --> Left semicircle, false --> Right semicircle.
1811  Rma, // radius of external Stt containment.
1812  &XintersectionList[nIntersections], // output, X list of intersections (maximal 2).
1813  &YintersectionList[nIntersections]
1814  );
1815  nIntersections += nIntersectionsCircle;
1816 
1817 //-------- the starting point of the track.
1818 
1819  if(nIntersections==0) return 0;
1820 
1821  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
1822  if(FiStart<0.) FiStart+= TWO_PI;
1823  if(FiStart<0.) FiStart =0.;
1824 
1825  // this method selects the entrance and exit points of the trajectory among all
1826  // geometrical intersections of the circular trajectory with the straw particular
1827  // volume; IT RETURNS all the intersections ordered from center to perifery according to the sense of
1828  // rotation dictated by the charge of the track;
1829  // the methods requires at least 2 intersection;
1830 
1831  ChooseEntranceExit3(
1832  Oxx,
1833  Oyy,
1834  Charge,
1835  FiStart,
1836  nIntersections,
1837  XintersectionList, // input and output;
1838  YintersectionList, // input and output;
1839  FiOrderedList // output;
1840  );
1841 
1842 
1843  return nIntersections;
1844 
1845 }
1846 
1847 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleLeft2
1848 
1849 
1850 
1851 
1852 //----------begin of function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleRight
1853 
1855  Double_t Oxx,
1856  Double_t Oyy,
1857  Double_t Rr,
1858  Short_t Charge,
1859  Double_t Start[3],
1860  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1861  Double_t Rma, // outer radius of the Circle.
1862  Double_t GAP,
1863  Double_t Xcross[2],
1864  Double_t Ycross[2]
1865  )
1866 {
1867 
1868 // This methods finds the intersections between a trajectory coming from (0,0) and
1869 // parameters Oxx, Oyy, Rr with the closed geometrical figure (in XY) formed by the STT
1870 // external Left semicircle and the Outer STT parallel Left straw semi-Hexagon + Gap for
1871 // the pellet target target.
1872 // It returns -1 if there are 0 or 1 intersections, or it returns 0
1873 // if they are at least 2.
1874 
1875 
1876 //------------------
1877 
1878  Short_t nIntersectionsCircle,
1879  nIntersections;
1880  Double_t FiStart,
1881  XintersectionList[12],
1882  YintersectionList[12]; // all the possible intersections (up to 10 intersections).
1883 
1884 // finding all possible intersections with inner parallel straw region.
1885 
1886 
1887  Double_t Side_x[] = { GAP/2., GAP/2. , ApotemaMin, ApotemaMin, GAP/2., GAP/2. },
1888  Side_y[] = { sqrt(Rma*Rma-GAP*GAP/4.), (2.*ApotemaMin-GAP/2.)/sqrt(3.),
1889  ApotemaMin/sqrt(3.),
1890  -ApotemaMin/sqrt(3.),
1891  -(2.*ApotemaMin-GAP/2.)/sqrt(3.), -sqrt(Rma*Rma-GAP*GAP/4.)},
1892  a[] = {1., 1./sqrt(3.), 1., -1./sqrt(3.), 1.},
1893  b[] = {0., 1., 0., 1., 0.},
1894  c[] = {-GAP/2.,-2.*ApotemaMin/sqrt(3.),-ApotemaMin, 2.*ApotemaMin/sqrt(3.), -GAP/2.};
1895 
1896  nIntersections=IntersectionsWithOpenPolygon(
1897  Oxx,
1898  Oyy,
1899  Rr,
1900  5, // n. Sides of open Polygon.
1901  a, // coefficient of formula : aX + bY + c = 0 defining the Polygon sides.
1902  b,
1903  c,
1904  Side_x, // X,Y coordinate of the Sides vertices (in sequence, following
1905  Side_y, // the Polygon along.
1906  XintersectionList, // XintersectionList
1907  YintersectionList // YintersectionList.
1908  );
1909 
1910 
1911 
1912 //-------------------------------------------------------------------------
1913 // finding intersections of trajectory [assumed to originate from (0,0) ]
1914 // with outer semicircle, the Left part.
1915 
1916  nIntersectionsCircle=IntersectionsWithGapSemicircle(
1917  Oxx, // input from trajectory
1918  Oyy, // input from trajectory
1919  Rr, // input from trajectory
1920  GAP, // input, vertical gap in XY plane of STT detector.
1921  false, // true --> Left semicircle, false --> Right semicircle.
1922  Rma, // radius of external Stt containment.
1923  &XintersectionList[nIntersections], // output, X list of intersections (maximal 2).
1924  &YintersectionList[nIntersections]
1925  );
1926 
1927 
1928  nIntersections += nIntersectionsCircle;
1929 
1930 //-------- the starting point of the track.
1931 
1932  if(nIntersections<2) return -1;
1933 
1934  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
1935  if(FiStart<0.) FiStart+= TWO_PI;
1936  if(FiStart<0.) FiStart =0.;
1937 
1938  // this method selects the entrance and exit points of the trajectory among all
1939  // geometrical intersections of the circular trajectory with the straw particular
1940  // volume.
1941 
1942  ChooseEntranceExitbis(
1943  Oxx,
1944  Oyy,
1945  Charge,
1946  FiStart,
1947  nIntersections,
1948  XintersectionList,
1949  YintersectionList,
1950  Xcross, // output
1951  Ycross // output
1952  );
1953 
1954 
1955  return 0;
1956 
1957 }
1958 
1959 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleRight
1960 
1961 
1962 
1963 
1964 
1965 //----------begin of function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleRight2
1966 
1968  Double_t Oxx,
1969  Double_t Oyy,
1970  Double_t Rr,
1971  Short_t Charge,
1972  Double_t Start[3],
1973  Double_t ApotemaMin, // Apotema=distance Hexagon side from (0,0).
1974  Double_t Rma, // outer radius of the Circle.
1975  Double_t GAP,
1976  Double_t XintersectionList[12],
1977  Double_t YintersectionList[12],
1978  Double_t FiOrderedList[12]
1979  )
1980 {
1981 
1982 // THIS METHOD IS ALMOST THE SAME AS FindTrackEntranceExitHexagonCircleLeft BUT IT PROVIDES ALL THE
1983 // INTERSECTIONS ORDERED FROM CENTER TO PERIFERY;
1984 // This methods finds the intersections between a trajectory coming from (0,0) and
1985 // parameters Oxx, Oyy, Rr with the closed geometrical figure (in XY) formed by the STT
1986 // external Left semicircle and the Outer STT parallel Left straw semi-Hexagon + Gap for
1987 // the pellet target target.
1988 // It returns the number of intersections (0 if there are no intersections);
1989 
1990 // At the most the number of such intersection is 12, that's why XintersectionList[12];
1991 // also the intersections are ordered from center to perifery according to the charge of the
1992 // track that dictates the sense of rotation;
1993 
1994  Short_t nIntersections;
1995 
1996  //Double_t cosFi, //[R.K. 01/2017] unused variable?
1997  //theta1, //[R.K. 01/2017] unused variable?
1998  //theta2, //[R.K. 01/2017] unused variable?
1999  //Theta1, //[R.K. 01/2017] unused variable?
2000  //Theta2, //[R.K. 01/2017] unused variable?
2001  //aaa, //[R.K. 01/2017] unused variable?
2002  //Fi, //[R.K. 01/2017] unused variable?
2003  //FI0, //[R.K. 01/2017] unused variable?
2004  //x1, //[R.K. 01/2017] unused variable?
2005  //x2, //[R.K. 01/2017] unused variable?
2006  //y1, //[R.K. 01/2017] unused variable?
2007  //y2; //[R.K. 01/2017] unused variable?
2008 //------------------
2009 
2010  Short_t nIntersectionsCircle;
2011  Double_t FiStart;
2012 
2013 // finding all possible intersections with inner parallel straw region.
2014 
2015 
2016  Double_t Side_x[] = { GAP/2., GAP/2. , ApotemaMin, ApotemaMin, GAP/2., GAP/2. },
2017  Side_y[] = { sqrt(Rma*Rma-GAP*GAP/4.), (2.*ApotemaMin-GAP/2.)/sqrt(3.),
2018  ApotemaMin/sqrt(3.),
2019  -ApotemaMin/sqrt(3.),
2020  -(2.*ApotemaMin-GAP/2.)/sqrt(3.), -sqrt(Rma*Rma-GAP*GAP/4.)},
2021  a[] = {1., 1./sqrt(3.), 1., -1./sqrt(3.), 1.},
2022  b[] = {0., 1., 0., 1., 0.},
2023  c[] = {-GAP/2.,-2.*ApotemaMin/sqrt(3.),-ApotemaMin, 2.*ApotemaMin/sqrt(3.), -GAP/2.};
2024 
2025  nIntersections=IntersectionsWithOpenPolygon(
2026  Oxx,
2027  Oyy,
2028  Rr,
2029  5, // n. Sides of open Polygon.
2030  a, // coefficient of formula : aX + bY + c = 0 defining the Polygon sides.
2031  b,
2032  c,
2033  Side_x, // X,Y coordinate of the Sides vertices (in sequence, following
2034  Side_y, // the Polygon along.
2035  XintersectionList, // XintersectionList
2036  YintersectionList // YintersectionList.
2037  );
2038 
2039 
2040 //-------------------------------------------------------------------------
2041 // finding intersections of trajectory [assumed to originate from (0,0) ]
2042 // with outer semicircle, the Left part.
2043 
2044  nIntersectionsCircle=IntersectionsWithGapSemicircle(
2045  Oxx, // input from trajectory
2046  Oyy, // input from trajectory
2047  Rr, // input from trajectory
2048  GAP, // input, vertical gap in XY plane of STT detector.
2049  false, // true --> Left semicircle, false --> Right semicircle.
2050  Rma, // radius of external Stt containment.
2051  &XintersectionList[nIntersections], // output, X list of intersections (maximal 2).
2052  &YintersectionList[nIntersections]
2053  );
2054 
2055  nIntersections += nIntersectionsCircle;
2056 
2057 //-------- the starting point of the track.
2058 
2059  if(nIntersections == 0) return 0;
2060 
2061  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
2062  if(FiStart<0.) FiStart+= TWO_PI;
2063  if(FiStart<0.) FiStart =0.;
2064 
2065  // this method selects the entrance and exit points of the trajectory among all
2066  // geometrical intersections of the circular trajectory with the straw particular
2067  // volume; IT RETURNS all the intersections ordered from center to perifery according to the sense of
2068  // rotation dictated by the charge of the track;
2069  // the methods requires at least 2 intersection;
2070 
2071  ChooseEntranceExit3(
2072  Oxx,
2073  Oyy,
2074  Charge,
2075  FiStart,
2076  nIntersections,
2077  XintersectionList, // input and output;
2078  YintersectionList, // input and output;
2079  FiOrderedList // output;
2080  );
2081 
2082 
2083  return nIntersections;
2084 
2085 }
2086 
2087 //----------end of function PndTrkCTGeometryCalculations::FindTrackEntranceExitHexagonCircleRight2
2088 
2089 
2090 //----------begin of function PndTrkCTGeometryCalculations::IntersectionCircle_Segment
2091 
2093  Double_t a, // coefficients implicit equation.
2094  Double_t b, // of segment : a*x + b*y + c =0.
2095  Double_t c,
2096  Double_t P1x, // point delimiting the segment.
2097  Double_t P2x, // point delimiting the segment.
2098  Double_t P1y, // point delimiting the segment.
2099  Double_t P2y, // point delimiting the segment.
2100  Double_t Oxx, // center of circle.
2101  Double_t Oyy,
2102  Double_t Rr, // Radius of circle;
2103  Short_t * Nintersections,
2104  Double_t XintersectionList[2],
2105  Double_t YintersectionList[2],
2106  Double_t *distance
2107  )
2108 {
2109 // this method finds the intersection of a circle with a segment. If the circle
2110 // passes through an endpoint of the segment, that is considered an intersection also.
2111 
2112  bool status;
2113 
2114  Short_t ipossibility;
2115 
2116  Double_t aperp,
2117  bperp,
2118  cperp,
2119  det,
2120  distq,
2121  //dist1, //[R.K. 01/2017] unused variable?
2122  //dist2, //[R.K. 01/2017] unused variable?
2123  length,
2124  length_segmentq,
2125  Rq,
2126  x,
2127  y,
2128  Xintersection,
2129  Yintersection;
2130 
2131  *Nintersections=0;
2132  det = a*a+b*b ;
2133  if(det < 1.e-20){
2134  cout<<"from PndTrkCTGeometryCalculations::IntersectionCircle_Segment :"
2135  <<" this is not the equation of a segment; a = "<<a<<", b = "
2136  <<b<<", return false!\n";
2137  return false;
2138  }
2139  // find if intersection circle - segment is possible.
2140  // check if there is an intersection (with the squares, it's the same!).
2141  distq = ( a*Oxx+ b*Oyy + c )*( a*Oxx+ b*Oyy + c )/det;
2142  *distance = sqrt(distq);
2143  Rq=Rr*Rr;
2144  length = Rq - distq;
2145  if(length <= 0. ) return false; // no intersection between trajectory and this
2146  // segment.
2147  length = sqrt(length);
2148  // coefficients of line perpendicular to input segment and passing for (Oxx, Oyy).
2149  aperp = -b;
2150  bperp = a;
2151  cperp = - aperp*Oxx - bperp*Oyy;
2152 
2153  // find intersection of segment with perpendicular : no need to check if
2154  // det is different from 0.
2155  Xintersection = (-bperp*c + b*cperp)/det;
2156  Yintersection = (-a*cperp + aperp*c)/det;
2157  det = sqrt(det);
2158  length_segmentq = (P1x-P2x)*(P1x-P2x) + (P1y-P2y)*(P1y-P2y);
2159  status = false;
2160  for(ipossibility=-1;ipossibility<2;ipossibility +=2){
2161  x = Xintersection + ipossibility*length*b/det ;
2162  y = Yintersection - ipossibility*length*a/det ;
2163  if ( (x-P1x)*(x-P1x)+(y-P1y)*(y-P1y) > length_segmentq // factor to take
2164  // (grossly) errors in trajectory into account;
2165  ||
2166  (x-P2x)*(x-P2x)+(y-P2y)*(y-P2y) > length_segmentq
2167  ) continue;
2168  status = true;
2169  XintersectionList[*Nintersections] = x;
2170  YintersectionList[*Nintersections] = y;
2171  (*Nintersections)++;
2172  } // end of for(ipossibility=-1; ...
2173 
2174  return status;
2175 }
2176 
2177 //----------end of function PndTrkCTGeometryCalculations::IntersectionCircle_Segment
2178 
2179 
2180 
2181 //----------begin of function PndTrkCTGeometryCalculations::IntersectionCircle_Segment_forScitil
2182 
2184  Double_t a, // coefficients implicit equation.
2185  Double_t b, // of segment : a*x + b*y + c =0.
2186  Double_t c,
2187  Double_t P1x, // point delimiting the segment.
2188  Double_t P2x, // point delimiting the segment.
2189  Double_t P1y, // point delimiting the segment.
2190  Double_t P2y, // point delimiting the segment.
2191  Double_t Oxx, // center of circle.
2192  Double_t Oyy,
2193  Double_t Rr, // Radius of circle;
2194  Double_t factor, // to take into account errors in the determination of the circumference;
2195  Short_t * Nintersections,
2196  Double_t XintersectionList[2],
2197  Double_t YintersectionList[2],
2198  Double_t *distance
2199  )
2200 {
2201 // this method finds the intersection of a circle with a segment. If the circle
2202 // passes through an endpoint of the segment, that is considered an intersection also.
2203 
2204  bool status;
2205 
2206  Short_t ipossibility;
2207 
2208  Double_t aperp,
2209  bperp,
2210  cperp,
2211  det,
2212  distq,
2213  //dist1, //[R.K. 01/2017] unused variable?
2214  //dist2, //[R.K. 01/2017] unused variable?
2215  length,
2216  length_segmentq,
2217  Rq,
2218  x,
2219  y,
2220  Xintersection,
2221  Yintersection;
2222 
2223  *Nintersections=0;
2224  det = a*a+b*b ;
2225  if(det < 1.e-20){
2226  cout<<"from PndTrkCTGeometryCalculations::IntersectionCircle_Segment :"
2227  <<" this is not the equation of a segment; a = "<<a<<", b = "
2228  <<b<<", return false!\n";
2229  return false;
2230  }
2231  // find if intersection circle - segment is possible.
2232  // check if there is an intersection (with the squares, it's the same!).
2233  distq = ( a*Oxx+ b*Oyy + c )*( a*Oxx+ b*Oyy + c )/det;
2234  *distance = sqrt(distq);
2235  Rq=Rr*Rr;
2236  length = Rq - distq;
2237  if(length <= 0. ) return false; // no intersection between trajectory and this
2238  // segment.
2239  length = sqrt(length);
2240  // coefficients of line perpendicular to input segment and passing for (Oxx, Oyy).
2241  aperp = -b;
2242  bperp = a;
2243  cperp = - aperp*Oxx - bperp*Oyy;
2244 
2245  // find intersection of segment with perpendicular : no need to check if
2246  // det is different from 0.
2247  Xintersection = (-bperp*c + b*cperp)/det;
2248  Yintersection = (-a*cperp + aperp*c)/det;
2249  det = sqrt(det);
2250  length_segmentq = (P1x-P2x)*(P1x-P2x) + (P1y-P2y)*(P1y-P2y);
2251  status = false;
2252  for(ipossibility=-1;ipossibility<2;ipossibility +=2){
2253  x = Xintersection + ipossibility*length*b/det ;
2254  y = Yintersection - ipossibility*length*a/det ;
2255  if ( (x-P1x)*(x-P1x)+(y-P1y)*(y-P1y) > factor*length_segmentq // factor to take
2256  // (grossly) errors in trajectory into account;
2257  ||
2258  (x-P2x)*(x-P2x)+(y-P2y)*(y-P2y) > factor*length_segmentq
2259  ) continue;
2260  status = true;
2261  XintersectionList[*Nintersections] = x;
2262  YintersectionList[*Nintersections] = y;
2263  (*Nintersections)++;
2264  } // end of for(ipossibility=-1; ...
2265 
2266  return status;
2267 }
2268 
2269 //----------end of function PndTrkCTGeometryCalculations::IntersectionCircle_Segment_forScitil
2270 
2271 //----------begin of function PndTrkCTGeometryCalculations::IntersectionSciTil_Circle
2273 // Double_t DIMENSIONSCITIL,
2274  Double_t posizSciTilx,
2275  Double_t posizSciTily,
2276  Double_t Oxx, // center of circle.
2277  Double_t Oyy,
2278  Double_t Rr, // Radius of circle.
2279  Short_t * Nintersections,
2280  Double_t XintersectionList[2],
2281  Double_t YintersectionList[2]
2282  )
2283 {
2284 
2285  bool intersect;
2286 
2287  Double_t
2288  distance,
2289  QQ,
2290  sqrtRR,
2291  SIGN;
2292 
2293 
2294  QQ = posizSciTilx*posizSciTilx+posizSciTily*posizSciTily;
2295  sqrtRR=sqrt(QQ);
2296 
2297  if( posizSciTily<0.) SIGN=-1.;
2298  else SIGN=1.;
2299 
2300 
2301  intersect = IntersectionCircle_Segment_forScitil(
2302  posizSciTilx,
2303  posizSciTily,
2304  -QQ,
2305  posizSciTilx-SIGN*0.5*DIMENSIONSCITIL*posizSciTily/sqrtRR,
2306  posizSciTilx+SIGN*0.5*DIMENSIONSCITIL*posizSciTily/sqrtRR,
2307  posizSciTily+SIGN*posizSciTilx*0.5*DIMENSIONSCITIL/sqrtRR,
2308  posizSciTily-SIGN*posizSciTilx*0.5*DIMENSIONSCITIL/sqrtRR,
2309  Oxx,
2310  Oyy,
2311  Rr,
2312  2.25, // factor to take into account errors in the determination of the trajectory circle;
2313  Nintersections, // output
2314  XintersectionList, // output
2315  YintersectionList, // output
2316  &distance // output
2317  );
2318 
2319  return intersect;
2320 }
2321 //----------end of function PndTrkCTGeometryCalculations::IntersectionSciTil_Circle
2322 
2323 
2324 
2325 
2326 //----------start function PndTrkCTGeometryCalculations::IntersectionsWithClosedbiHexagonLeft
2327 
2329  //-------- inputs
2330  Double_t vgap,
2331  Double_t Oxx,
2332  Double_t Oyy,
2333  Double_t Rr,
2334  Double_t Ami, // min Apotema of hexagonal volume intersected by track;
2335  Double_t Ama, // max Apotema of hexagonal volume intersected by track;
2336  //-------- outputs
2337  Short_t *nIntersections,
2338  Double_t *XintersectionList,
2339  Double_t *YintersectionList
2340  )
2341 {
2342 
2343 
2344  // return integer convention :
2345  // -1 --> track outside outer perimeter;
2346  // 0 --> at least 1 intersection with polygon;
2347  // 1 --> track contained completely between the two polygons;
2348 
2349 
2350  // inner Hexagon --> 0
2351  // outer Hexagon --> 1
2352 
2353  bool internal,
2354  AtLeast1;
2355 
2356  Short_t is,
2357  j,
2358  Nintersections;
2359 
2360  Double_t aaa,
2361  maxdistq,
2362  distance,
2363  //-------------------
2364  // a,b,c == coefficients of the implicit equations of the 3 sides of the half inner Hexagon
2365  // plus 3 sides of the half outer Hexagon plus 2 vertical sides corresponding to the Gap :
2366  // a*x + b*y +c =0; the numbering of these 8 sides follows the convention of Gianluigi's
2367  // logbook on page 286.
2368 a[] = {-1./sqrt(3.) , 1., 1./sqrt(3.), 1., 1./sqrt(3.), 1., -1./sqrt(3.), 1.},
2369 b[] = {1., 0., 1., 0., 1., 0., 1., 0.},
2370 c[] = {-2.*Ama/sqrt(3.),Ama, 2.*Ama/sqrt(3.),vgap/2.,2.*Ami/sqrt(3.),Ami, -2.*Ami/sqrt(3.),vgap/2.},
2371  //----------------------
2372 
2373  tempX[2],
2374  tempY[2];
2375 
2376  // side_x and side_y are ordered as side1, side2, ..... in Gianluigi's logbook on page 286.
2377  Double_t
2378  side_x[] = { -vgap/2., -Ama , -Ama, -vgap/2., -vgap/2., -Ami,
2379  -Ami, -vgap/2., -vgap/2.},
2380  side_y[] = {(-0.5*vgap+2.*Ama)/sqrt(3.), Ama/sqrt(3.), -Ama/sqrt(3.),
2381  -(-0.5*vgap+2.*Ama)/sqrt(3.), -(-0.5*vgap+2.*Ami)/sqrt(3.),
2382  -Ami/sqrt(3.), Ami/sqrt(3.), (-0.5*vgap+2.*Ami)/sqrt(3.),
2383  (-0.5*vgap+2.*Ama)/sqrt(3.) };
2384 
2385 
2386 
2387 //-----------------------
2388 
2389 // find intersections (maximum 16) with the 8 sides.
2390 
2391 
2392 
2393  AtLeast1 = false;
2394  *nIntersections =0;
2395  internal = true;
2396  maxdistq=-9999.;
2397  for(is=0; is<8; is++){
2398  aaa = (side_x[is]-Oxx)*(side_x[is]-Oxx)+(side_y[is]-Oyy)*(side_y[is]-Oyy);
2399  if(aaa>maxdistq) maxdistq=aaa;
2400  aaa = (side_x[is+1]-Oxx)*(side_x[is+1]-Oxx)+(side_y[is+1]-Oyy)*(side_y[is+1]-Oyy);
2401  if(aaa>maxdistq) maxdistq=aaa;
2402  if ( IntersectionCircle_Segment(
2403  a[is],
2404  b[is],
2405  c[is],
2406  side_x[is],
2407  side_x[is+1],
2408  side_y[is],
2409  side_y[is+1],
2410  Oxx,
2411  Oyy,
2412  Rr,
2413  &Nintersections,
2414  tempX,
2415  tempY,
2416  &distance // distance of (Oxx,Oyy) from line
2417  // defined by a*x+b*y+c=0.
2418  )
2419  ){
2420  AtLeast1=true;
2421  for(j=0;j<Nintersections;j++){
2422  XintersectionList[ *nIntersections ] =tempX[j];
2423  YintersectionList[ *nIntersections ] =tempY[j];
2424  (*nIntersections)++;
2425  }
2426  } // end of if ( IntersectionCircle_Segment( .....
2427 
2428 
2429  // the definition of 'internal' here is when the given Point
2430  // stays at the same side of the origin (0,0) with respect to
2431  // the given line of equation a*x+b*y+c=0.
2432  if(is<3) {
2433  internal = internal && IsInternal(Oxx,
2434  Oyy,
2435  a[is],
2436  b[is],
2437  c[is]
2438  );
2439  } else {
2440  internal = internal && (!IsInternal(Oxx,
2441  Oyy,
2442  a[is],
2443  b[is],
2444  c[is]
2445  ) );
2446  }
2447 
2448  } // end of for(is=0; is<8; is++)
2449 
2450 
2451  if( !AtLeast1){
2452  if (!internal) return -1;// trajectory outside polygon.
2453  if( maxdistq < Rr*Rr ) return -1;// trajectory outside polygon.
2454  return 1; // trajectory completely contained inside this Polygon.
2455  }
2456  return 0;
2457 
2458 }
2459 
2460 //---------- end of function PndTrkCTGeometryCalculations::IntersectionsWithClosedbiHexagonLeft
2461 
2462 
2463 
2464 
2465 
2466 
2467 
2468 //----------start function PndTrkCTGeometryCalculations::IntersectionsWithClosedbiHexagonRight
2469 
2471  //-------- inputs
2472  Double_t vgap,
2473  Double_t Oxx,
2474  Double_t Oyy,
2475  Double_t Rr,
2476  Double_t Ami, // min Apotema of hexagonal volume intersected by track;
2477  Double_t Ama, // max Apotema of hexagonal volume intersected by track;
2478  //-------- outputs
2479  Short_t *nIntersections,
2480  Double_t *XintersectionList,
2481  Double_t *YintersectionList
2482  )
2483 {
2484 
2485 
2486  // return integer convention :
2487  // -1 --> track outside outer perimeter;
2488  // 0 --> at least 1 intersection with polygon;
2489  // 1 --> track contained completely between the two polygons;
2490 
2491 
2492  // inner Hexagon --> 0
2493  // outer Hexagon --> 1
2494 
2495  bool internal,
2496  AtLeast1;
2497 
2498  Short_t //i, //[R.K. 01/2017] unused variable?
2499  is,
2500  j,
2501  Nintersections;
2502 
2503  Double_t aaa,
2504  maxdistq,
2505  distance,
2506  //-------------------
2507  // a,b,c == coefficients of the implicit equations of the 3 sides of the half inner Hexagon
2508  // plus 3 sides of the half outer Hexagon plus 2 vertical sides corresponding to the Gap :
2509  // a*x + b*y +c =0; the numbering of these 8 sides foolows the convention of Gianluigi's
2510  // logbook on page 286.
2511 a[] = {1./sqrt(3.) , 1., -1./sqrt(3.), 1., -1./sqrt(3.), 1., 1./sqrt(3.), 1.},
2512 b[] = {1., 0., 1., 0., 1., 0., 1., 0.},
2513 c[] = {-2.*Ama/sqrt(3.),-Ama, 2.*Ama/sqrt(3.),-vgap/2.,2.*Ami/sqrt(3.),-Ami, -2.*Ami/sqrt(3.),-vgap/2.},
2514  //----------------------
2515 
2516  tempX[2],
2517  tempY[2];
2518 
2519  // side_x and side_y are ordered as side1, side2, ..... in Gianluigi's logbook on page 286.
2520  Double_t
2521  side_x[] = { vgap/2., Ama , Ama, vgap/2., vgap/2., Ami,
2522  Ami, vgap/2., vgap/2.},
2523  side_y[] = {(-0.5*vgap+2.*Ama)/sqrt(3.), Ama/sqrt(3.), -Ama/sqrt(3.),
2524  -(-0.5*vgap+2.*Ama)/sqrt(3.), -(-0.5*vgap+2.*Ami)/sqrt(3.),
2525  -Ami/sqrt(3.), Ami/sqrt(3.), (-0.5*vgap+2.*Ami)/sqrt(3.),
2526  (-0.5*vgap+2.*Ama)/sqrt(3.) };
2527 
2528 
2529 
2530 //-----------------------
2531 
2532 // find intersections (maximum 16) with the 8 sides.
2533 
2534  AtLeast1 = false;
2535  *nIntersections =0;
2536  internal = true;
2537  maxdistq=-9999.;
2538  for(is=0; is<8; is++){
2539  aaa = (side_x[is]-Oxx)*(side_x[is]-Oxx)+(side_y[is]-Oyy)*(side_y[is]-Oyy);
2540  if(aaa>maxdistq) maxdistq=aaa;
2541  aaa = (side_x[is+1]-Oxx)*(side_x[is+1]-Oxx)+(side_y[is+1]-Oyy)*(side_y[is+1]-Oyy);
2542  if(aaa>maxdistq) maxdistq=aaa;
2543  if ( IntersectionCircle_Segment(
2544  a[is],
2545  b[is],
2546  c[is],
2547  side_x[is],
2548  side_x[is+1],
2549  side_y[is],
2550  side_y[is+1],
2551  Oxx,
2552  Oyy,
2553  Rr,
2554  &Nintersections,
2555  tempX,
2556  tempY,
2557  &distance // distance of (Oxx,Oyy) from line
2558  // defined by a*x+b*y+c=0.
2559  )
2560  )
2561  {
2562  AtLeast1=true;
2563  for(j=0;j<Nintersections;j++){
2564  XintersectionList[ *nIntersections ] =tempX[j];
2565  YintersectionList[ *nIntersections ] =tempY[j];
2566  (*nIntersections)++;
2567  }
2568  } // end of if ( IntersectionCircle_Segment( .....
2569 
2570 
2571  // the definition of 'internal' here is when the given Point
2572  // stays at the same side of the origin (0,0) with respect to
2573  // the given line of equation a*x+b*y+c=0.
2574  if(is<3) {
2575  internal = internal && IsInternal(Oxx,
2576  Oyy,
2577  a[is],
2578  b[is],
2579  c[is]
2580  );
2581  } else {
2582  internal = internal && (!IsInternal(Oxx,
2583  Oyy,
2584  a[is],
2585  b[is],
2586  c[is]
2587  ) );
2588  }
2589 
2590  } // end of for(is=0; is<8; is++)
2591 
2592 
2593  if( !AtLeast1){
2594  if (!internal) return -1;// trajectory outside polygon.
2595  if( maxdistq < Rr*Rr ) return -1;// trajectory outside polygon.
2596  return 1; // trajectory completely contained inside this Polygon.
2597  }
2598  return 0;
2599 
2600 }
2601 
2602 //---------- end of function PndTrkCTGeometryCalculations::IntersectionsWithClosedbiHexagonRight
2603 
2604 
2605 
2606 //----------start function PndTrkCTGeometryCalculations::IntersectionsWithClosedPolygon
2607 
2609  //-------- inputs
2610  Double_t Oxx,
2611  Double_t Oyy,
2612  Double_t Rr,
2613  Double_t Rmi, // min Apotema of hexagonal volume intersected by track;
2614  Double_t Rma, // max Apotema of hexagonal volume intersected by track;
2615  //-------- outputs
2616  Short_t nIntersections[2],
2617  Double_t XintersectionList[][2],
2618  Double_t YintersectionList[][2]
2619  )
2620 {
2621 
2622 
2623  // return integer convention :
2624  // -2 --> track outside outer polygon;
2625  // -1 --> track contained completely within inner polygon;
2626  // 0 --> at least 1 intersection with inner polygon, at least 1 with outer polygon;
2627  // 1 --> track contained completely between the two polygons;
2628  // 2 --> track contained completely by larger polygons, with intersections in the smaller;
2629  // 3 --> track completely outsiede the small polygon with intersections in the bigger.
2630 
2631 
2632  // inner Hexagon --> 0
2633  // outer Hexagon --> 1
2634 
2635  bool internal[2],
2636  AtLeast1[2];
2637 
2638  Short_t i,
2639  is,
2640  j,
2641  Nintersections;
2642 
2643  Double_t mindist[2],
2644  distance,
2645  //-------------------
2646  // a,b,c == coefficients of the implicit equations of the six sides of the Hexagon
2647  // centered at 0 : a*x + b*y +c =0; see Gianluigi's logbook on page 277;
2648  // the coefficient c has to be multiplied by Erre.
2649  // The first side is
2650  a[] = { 1./sqrt(3.) , 1., -1./sqrt(3.), 1./sqrt(3.) , 1. , -1./sqrt(3.) } ,
2651  b[] = { 1., 0. , 1., 1., 0. , 1. },
2652  c[] = { -2./sqrt(3.) , -1., 2./sqrt(3.), 2./sqrt(3.), 1., -2./sqrt(3.)},
2653  //----------------------
2654 
2655  Erre[] = {Rmi, Rma}, // this is the distance from (0,0)
2656  // of the SIDES of the Hexagon delimiting the Skew area
2657  tempX[2],
2658  tempY[2];
2659 
2660  // both hexagon_side_xlow and hexagon_side_xup must be multiplied by appropriate Erre;
2661  // sides of Hexagon ordered as a, b, c ..... in Gianluigi's logbook on page 280.
2662  Double_t
2663  hexagon_side_x[] = { 0., 1. , 1., 0., -1., -1., 0. },
2664  hexagon_side_y[] = { 2./sqrt(3.),1./sqrt(3.),-1./sqrt(3.),
2665  -2./sqrt(3.),-1./sqrt(3.), 1./sqrt(3.), 2./sqrt(3.)};
2666 
2667 
2668 
2669 //-----------------------
2670 
2671 // find intersection with the 6 sides of the small exhagon delimiting the skew straws zone
2672 // see on page 277 of Gianluigi's logbook.
2673 
2674  // status =0, at least 1 intersection with inner Hexagon, at least 1 intersection
2675  // with the outer Hexagon; =1, track contained completely between the
2676  // two Hexagons; = -1 track contained within inner Hexagon;
2677  // =-2 track outside outer Hexagon.
2678 
2679 
2680  for(i=0;i<2;i++){ // i=0 --> inner Hexagon, i= 1 --> outer Hexagon.
2681  AtLeast1[i] = false;
2682  nIntersections[i]=0;
2683  internal[i] = true;
2684  mindist[i]=999999.;
2685  for(is=0; is<6; is++){
2686  if ( IntersectionCircle_Segment(a[is],
2687  b[is],
2688  c[is]*Erre[i],
2689  hexagon_side_x[is]*Erre[i],
2690  hexagon_side_x[is+1]*Erre[i],
2691  hexagon_side_y[is]*Erre[i],
2692  hexagon_side_y[is+1]*Erre[i],
2693  Oxx,
2694  Oyy,
2695  Rr,
2696  &Nintersections,
2697  tempX,
2698  tempY,
2699  &distance // distance of (Oxx,Oyy) from line
2700  // defined by a*x+b*y+c=0.
2701  )
2702  )
2703  {
2704  AtLeast1[i]=true;
2705  for(j=0;j<Nintersections;j++){
2706  XintersectionList[ nIntersections[i] ][i] =tempX[j];
2707  YintersectionList[ nIntersections[i] ][i] =tempY[j];
2708  nIntersections[i]++;
2709  }
2710  } // end of if ( IntersectionCircle_Segment( .....
2711 
2712  if(mindist[i]>distance) mindist[i]=distance;
2713 
2714  // the definition of 'internal' here is when the given Point
2715  // stays at the same side of the origin (0,0) with respect to
2716  // the given line of equation a*x+b*y+c=0.
2717  internal[i] = internal[i] && IsInternal(Oxx,
2718  Oyy,
2719  a[is],
2720  b[is],
2721  c[is]*Erre[i]
2722  );
2723 
2724  } // end of for(is=0; is<6; is++)
2725  } // end of for(i=0;i<2;i++)
2726 
2727 
2728  if( (!AtLeast1[0]) && (!AtLeast1[1]) ){
2729  if (!internal[1]) return -2; // trajectory outside outer Hexagon.
2730  if( Rr > mindist[1]) return -2;
2731  if( !internal[0]) return 1; // trajectory contained between inner and outer Hexagon.
2732  if( mindist[0] >= Rr) return -1; // trajectory contained in inner Hexagon.
2733  return 1; // trajectory contained between inner and outer Hexagon.
2734  } else if (AtLeast1[0] && AtLeast1[1] ){ // continuation of if( (!AtLeast1[0]) && ...
2735  return 0;
2736  } else if (AtLeast1[0]){
2737  return 2;
2738  }
2739 
2740  return 3;
2741 }
2742 
2743 //---------- end of function PndTrkCTGeometryCalculations::IntersectionsWithClosedPolygon
2744 
2745 
2746 
2747 //----------begin of function PndTrkCTGeometryCalculations::IntersectionsWithGapSemicircle
2748 
2750  Double_t Oxx,
2751  Double_t Oyy,
2752  Double_t Rr,
2753  Double_t GAP,
2754  bool left, // if true --> Left semicircle; false --> Right semicircle.
2755  Double_t Rma,
2756  Double_t *XintersectionList,
2757  Double_t *YintersectionList
2758  )
2759 {
2760 
2761  Short_t nIntersectionsCircle;
2762 
2763  Double_t cosFi,
2764  theta1,
2765  theta2,
2766  Theta1,
2767  Theta2,
2768  aaa,
2769  Fi,
2770  FI0,
2771  x1,
2772  x2,
2773  y1,
2774  y2;
2775 
2776 
2777 
2778  nIntersectionsCircle=0;
2779  aaa = sqrt(Oxx*Oxx+Oyy*Oyy);
2780 
2781  // preliminary condition for having intersections between trajectory and Circle.
2782 
2783  if( !( aaa >= Rr + Rma || Rr >= aaa + Rma) &&
2784  !( aaa + Rr <= Rma || aaa - Rr >= Rma ) ) {
2785 
2786 // now the calculation
2787 
2788  FI0 = atan2(-Oyy,-Oxx);
2789  cosFi = (aaa*aaa + Rr*Rr - Rma*Rma)/(2.*Rr*aaa);
2790  if(cosFi<-1.) cosFi=-1.; else if(cosFi>1.) cosFi=1.;
2791  Fi = acos(cosFi);
2792 
2793 
2794  // (x1, y1) and (x2,y2) are the intersections between the trajectory
2795  // and the circle, in the laboratory reference frame.
2796  x1 = Oxx+Rr*cos(FI0 - Fi);
2797  y1 = Oyy+Rr*sin(FI0 - Fi);
2798  theta1 = atan2(y1,x1); // in this way theta1 is between -PI and PI.
2799  x2 = Oxx+Rr*cos(FI0 + Fi);
2800  y2 = Oyy+Rr*sin(FI0 + Fi);
2801  theta2 = atan2(y2,x2); // in this way theta2 is between -PI and PI.
2802  // Theta1, Theta2 = angle of the edges of the outer circle + Gap in the laboratory frame.
2803  // Theta1, Theta2 are angles between -PI/2 and +PI/2.
2804  if(!left){ // Right (looking into the beam) Semicircle.
2805  Theta2 = atan2( sqrt(Rma*Rma-GAP*GAP/4.),GAP/2.);
2806  Theta1 = atan2( -sqrt(Rma*Rma-GAP*GAP/4.),GAP/2.);
2807  if( Theta1<= theta1 && theta1 <= Theta2 ){
2808  XintersectionList[nIntersectionsCircle]=x1;
2809  YintersectionList[nIntersectionsCircle]=y1;
2810  nIntersectionsCircle++;
2811  }
2812  if( Theta1<= theta2 && theta2 <= Theta2 ){
2813  XintersectionList[nIntersectionsCircle]=x2;
2814  YintersectionList[nIntersectionsCircle]=y2;
2815  nIntersectionsCircle++;
2816  }
2817  } else { // Left (looking into the beam) Semicircle.
2818  Theta2 = atan2( -sqrt(Rma*Rma-GAP*GAP/4.),-GAP/2.);
2819  Theta1 = atan2( sqrt(Rma*Rma-GAP*GAP/4.),-GAP/2.);
2820  if( Theta1<= theta1 || theta1 <= Theta2 ){
2821  XintersectionList[nIntersectionsCircle]=x1;
2822  YintersectionList[nIntersectionsCircle]=y1;
2823  nIntersectionsCircle++;
2824  }
2825  if( Theta1<= theta2 || theta2 <= Theta2 ){
2826  XintersectionList[nIntersectionsCircle]=x2;
2827  YintersectionList[nIntersectionsCircle]=y2;
2828  nIntersectionsCircle++;
2829  }
2830  }
2831 
2832  } // end of if (!( a >= Rr + Rma || .....
2833 
2834 //---------------------------- end of calculation intersection with outer circle.
2835 
2836  return nIntersectionsCircle;
2837 
2838 
2839 }
2840 //----------end of function PndTrkCTGeometryCalculations::IntersectionsWithGapSemicircle
2841 
2842 
2843 
2844 //----------start function PndTrkCTGeometryCalculations::IntersectionsWithOpenPolygon
2845 
2847  //-------- inputs
2848  Double_t Oxx, // Track parameter
2849  Double_t Oyy, // Track parameter
2850  Double_t Rr, // Track parameter
2851  Short_t nSides, // input, n. of Sides of open Polygon.
2852  Double_t *a, // coefficient of formula : aX + bY + c = 0 defining
2853  Double_t *b, // the Polygon sides.
2854  Double_t *c,
2855  Double_t *Side_x, // X,Y coordinate of the Sides vertices (in sequence, following
2856  Double_t *Side_y, // the Polygon along.
2857  //-------- outputs
2858  Double_t *XintersectionList, // XintersectionList
2859  Double_t *YintersectionList // YintersectionList.
2860  )
2861 {
2862 
2863  // this methods returns the n. of intersections.
2864 
2865  Short_t //i, //[R.K. 01/2017] unused variable?
2866  is,
2867  j,
2868  nIntersections,
2869  Nintersections;
2870 
2871  Double_t //mindist, //[R.K. 01/2017] unused variable?
2872  distance,
2873  //-------------------
2874  // a,b,c == coefficients of the implicit equations of the six sides of the Hexagon
2875  // centered at 0 : a*x + b*y +c =0; see Gianluigi's logbook on page 277;
2876  // the coefficient c has to be multiplied by Erre.
2877 
2878  tempX[2],
2879  tempY[2];
2880 
2881 
2882 
2883 
2884 //-----------------------
2885 
2886  nIntersections=0;
2887  for(is=0; is<nSides; is++){
2888  if ( IntersectionCircle_Segment(a[is],
2889  b[is],
2890  c[is],
2891  Side_x[is],
2892  Side_x[is+1],
2893  Side_y[is],
2894  Side_y[is+1],
2895  Oxx,
2896  Oyy,
2897  Rr,
2898  &Nintersections,
2899  tempX,
2900  tempY,
2901  &distance // distance of (Oxx,Oyy) from line
2902  // defined by a*x+b*y+c=0.
2903  )
2904  ){
2905 
2906 
2907  for(j=0;j<Nintersections;j++){
2908  XintersectionList[ nIntersections ] =tempX[j];
2909  YintersectionList[ nIntersections ] =tempY[j];
2910  nIntersections ++;
2911  }
2912  } // end of if ( IntersectionCircle_Segment( .....
2913 
2914 
2915  } // end of for(is=0; is<nSides; is++)
2916 // } // end of for(i=0;i<2;i++)
2917 
2918 
2919 
2920  return nIntersections;
2921 }
2922 
2923 //---------- end of function PndTrkCTGeometryCalculations::IntersectionsWithOpenPolygon
2924 
2925 
2926 
2927 //----------begin of function PndTrkCTGeometryCalculations::IsInsideArc
2928 
2930  Double_t Oxx,
2931  Double_t Oyy,
2932  Short_t Charge,
2933  Double_t Xcross[2],
2934  Double_t Ycross[2],
2935  Double_t f // f has to be between 0 and 2PI.
2936  )
2937 {
2938 
2939  Double_t f1,
2940  f2;
2941 
2942 
2943  // Xcross[0],Ycross[0] is the point of entrance.
2944 
2945 
2946  f1 = atan2(Ycross[0]-Oyy, Xcross[0]-Oxx);
2947  if(f1<0.) f1+= TWO_PI;
2948  if(f1<0.) f1= 0.;
2949  f2 = atan2(Ycross[1]-Oyy, Xcross[1]-Oxx);
2950  if(f2<0.) f2+= TWO_PI;
2951  if(f2<0.) f2= 0.;
2952 
2953 
2954 
2955  if(Charge<0){
2956  if(f1 > f2 ) f2 +=TWO_PI;
2957  if(f1 > f2 ) f2 = f1;
2958  if( f>f1){
2959  if(f<f2) return true; else return false;
2960  } else {
2961  f +=TWO_PI;
2962  if(f<f1) f= f1;
2963  if(f<f2) return true; else return false;
2964  }
2965  } else { // Charge > 0.
2966  if(f1 < f2 ) f1 +=TWO_PI;
2967  if(f1 < f2 ) f1 = f2;
2968  if( f>f2){
2969  if(f<f1) return true; else return false;
2970  } else {
2971  f +=TWO_PI;
2972  if(f<f2) f= f2;
2973  if(f<f1) return true; else return false;
2974  }
2975  } // end of if(Charge<0)
2976 }
2977 
2978 //----------end of function PndTrkCTGeometryCalculations::IsInsideArc
2979 
2980 
2981 
2982 
2983 
2984 
2985 
2986 
2987 
2988 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk1_97to1_99
2989 
2991  Double_t X, // X coordinate of point;
2992  Double_t Y // Y coordinate of point;
2993  )
2994 {
2995 // this is a set of sensors placed vertically perpendicularly to the Z direction;
2996 // they are placed between 1.97 and 1.99 in Z;
2997 // look at Gianluigi's logbook on page 193 for the geometry detail;
2998 
2999  if(
3000  (X > -2.33 && X < -1.17 && Y > -2.26 && Y < 2.26 )
3001  ||
3002  (X > 0. && X < 1.21 && fabs(Y) < 3.43 && fabs(Y) > 1.19)
3003  ||
3004  (X > 2.32 && X < 3.48 && fabs(Y) < 1.12)
3005  ) return true;
3006 
3007  return false;
3008 }
3009 
3010 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk1_97to1_99
3011 
3012 
3013 
3014 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk1_97to1_99withMargin
3015 
3017  Double_t X, // X coordinate of point;
3018  Double_t Y, // Y coordinate of point;
3019  Double_t xmargin, // safety margin in X coordinate;
3020  Double_t ymargin // safety margin in Y coordinate;
3021  )
3022 {
3023 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3024 // they are placed between 1.97 and 1.99 in Z;
3025 // look at Gianluigi's logbook on page 193 for the geometry detail;
3026 
3027  if(
3028  (X > -2.33 + xmargin && X < -1.17 - xmargin && Y > -2.26 + ymargin && Y < 2.26 - ymargin )
3029  ||
3030  (X > 0. + xmargin && X < 1.21 - xmargin && fabs(Y) < 3.43 && fabs(Y) > 1.19)
3031  ||
3032  (X > 2.32 + xmargin && X < 3.48 - xmargin && fabs(Y) < 1.12 - ymargin)
3033  ) return true;
3034 
3035  return false;
3036 }
3037 
3038 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk1_97to1_99withMargin
3039 
3040 
3041 
3042 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk2_41to2_43
3043 
3045  Double_t X, // X coordinate of point;
3046  Double_t Y // Y coordinate of point;
3047  )
3048 {
3049 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3050 // they are placed between 2.41 and 2.43 in Z;
3051 // look at Gianluigi's logbook on page 194 for the geometry detail;
3052 
3053 
3054  if(
3055  ( X > 1.17 && X < 2.33 && Y > -2.26 && Y < 2.26 )
3056  ||
3057  ( X < 0. && X > -1.21 && fabs(Y) < 3.43 && fabs(Y) > 1.19)
3058  ||
3059  ( X < -2.32 && X > -3.48 && fabs(Y) < 1.12)
3060  ) return true;
3061 
3062  return false;
3063 }
3064 
3065 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk2_41to2_43
3066 
3067 
3068 
3069 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk2_41to2_43withMargin
3070 
3072  Double_t X, // X coordinate of point;
3073  Double_t Y, // Y coordinate of point;
3074  Double_t xmargin, // safety margin in X coordinate;
3075  Double_t ymargin // safety margin in Y coordinate;
3076  )
3077 {
3078 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3079 // they are placed between 2.41 and 2.43 in Z;
3080 // look at Gianluigi's logbook on page 194 for the geometry detail;
3081 
3082  if(
3083  ( X > 1.17 + xmargin && X < 2.33 - xmargin && Y > -2.26 + ymargin && Y < 2.26 - ymargin )
3084  ||
3085  ( X < 0. - xmargin && X > -1.21 + xmargin && fabs(Y) < 3.43 - ymargin && fabs(Y) > 1.19 + ymargin )
3086  ||
3087  ( X < -2.32 - xmargin && X > -3.48 + xmargin && fabs(Y) < 1.12 - ymargin )
3088  ) return true;
3089 
3090 
3091  return false;
3092 }
3093 
3094 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk2_41to2_43withMargin
3095 
3096 
3097 
3098 
3099 
3100 
3101 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk3_97to3_99
3102 
3104  Double_t X, // X coordinate of point;
3105  Double_t Y // Y coordinate of point;
3106  )
3107 {
3108 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3109 // they are placed between 3.97 and 3.99 in Z;
3110 // look at Gianluigi's logbook on page 195 for the geometry detail;
3111 
3112 
3113  if(
3114  ( X > 1.17 && X < 2.33 && Y > -2.26 && Y < 2.26 )
3115  ||
3116  ( X < 0. && X > -1.21 && fabs(Y) < 3.43 && fabs(Y) > 1.19)
3117  ||
3118  ( X < -2.32 && X > -3.48 && fabs(Y) < 1.12)
3119  ) return true;
3120 
3121 
3122  return false;
3123 }
3124 
3125 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk3_97to3_99
3126 
3127 
3128 
3129 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk3_97to3_99withMargin
3130 
3132  Double_t X, // X coordinate of point;
3133  Double_t Y, // Y coordinate of point;
3134  Double_t xmargin, // safety margin in X coordinate;
3135  Double_t ymargin // safety margin in Y coordinate;
3136  )
3137 {
3138 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3139 // they are placed between 3.97 and 3.99 in Z;
3140 // look at Gianluigi's logbook on page 193 for the geometry detail;
3141 
3142  if(
3143  ( X > 1.17 + xmargin && X < 2.33 - xmargin && Y > -2.26 + ymargin && Y < 2.26 - ymargin )
3144  ||
3145  ( X < 0. - xmargin && X > -1.21 + xmargin && fabs(Y) < 3.43 - ymargin && fabs(Y) > 1.19 + ymargin )
3146  ||
3147  ( X < -2.32 - xmargin && X > -3.48 + xmargin && fabs(Y) < 1.12 - ymargin )
3148  ) return true;
3149 
3150  return false;
3151 }
3152 
3153 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk3_97to3_99withMargin
3154 
3155 
3156 
3157 
3158 
3159 
3160 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk4_41to4_43
3161 
3163  Double_t X, // X coordinate of point;
3164  Double_t Y // Y coordinate of point;
3165  )
3166 {
3167 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3168 // they are placed between 4.41 and 4.43 in Z;
3169 // look at Gianluigi's logbook on page 195 for the geometry detail;
3170 
3171  if(
3172  (X > -2.33 && X < -1.17 && Y > -2.26 && Y < 2.26 )
3173  ||
3174  (X > 0. && X < 1.21 && fabs(Y) < 3.43 && fabs(Y) > 1.19)
3175  ||
3176  (X > 2.32 && X < 3.48 && fabs(Y) < 1.12)
3177  ) return true;
3178 
3179  return false;
3180 }
3181 
3182 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk4_41to4_43
3183 
3184 
3185 
3186 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk4_41to4_43withMargin
3187 
3189  Double_t X, // X coordinate of point;
3190  Double_t Y, // Y coordinate of point;
3191  Double_t xmargin, // safety margin in X coordinate;
3192  Double_t ymargin // safety margin in Y coordinate;
3193  )
3194 {
3195 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3196 // they are placed between 4.41 and 4.43 in Z;
3197 // look at Gianluigi's logbook on page 195 for the geometry detail;
3198 
3199  if(
3200  (X > -2.33 + xmargin && X < -1.17 - xmargin && Y > -2.26 + ymargin && Y < 2.26 - ymargin )
3201  ||
3202  (X > 0. + xmargin && X < 1.21 - xmargin && fabs(Y) < 3.43 && fabs(Y) > 1.19)
3203  ||
3204  (X > 2.32 + xmargin && X < 3.48 - xmargin && fabs(Y) < 1.12 - ymargin)
3205  ) return true;
3206 
3207  return false;
3208 }
3209 
3210 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk4_41to4_43withMargin
3211 
3212 
3213 
3214 
3215 
3216 
3217 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk6_97to6_99
3218 
3220  Double_t X, // X coordinate of point;
3221  Double_t Y // Y coordinate of point;
3222  )
3223 {
3224 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3225 // they are placed between 6.97 and 6.99 in Z;
3226 // look at Gianluigi's logbook on page 195 for the geometry detail;
3227 
3228  if(
3229  (X > -6.96 && X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3230  ||
3231  (X > -4.64 && X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3232  ||
3233  (X > -2.33 && X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3234  ||
3235  (X > 0. && X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3236  ||
3237  (X > 2.3 && X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3238  ||
3239  (X > 4.64 && X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3240  ) return true;
3241 
3242  return false;
3243 }
3244 
3245 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk6_97to6_99
3246 
3247 
3248 
3249 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk6_97to6_99withMargin
3250 
3252  Double_t X, // X coordinate of point;
3253  Double_t Y, // Y coordinate of point;
3254  Double_t xmargin, // safety margin in X coordinate;
3255  Double_t ymargin // safety margin in Y coordinate;
3256  )
3257 {
3258 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3259 // they are placed between 6.97 and 6.99 in Z;
3260 // look at Gianluigi's logbook on page 195 for the geometry detail;
3261 
3262 
3263  if(
3264  (X > -6.96 + xmargin && X < -5.8 - xmargin && fabs(Y) < 2.31 - ymargin && fabs(Y) > 0.07 + ymargin)
3265  ||
3266  (X > -4.64 + xmargin && X < -3.48 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3267  ||
3268  (X > -2.33 + xmargin && X < -1.17 - xmargin && fabs(Y) < 6.87 - ymargin && fabs(Y) > 0.07 + ymargin)
3269  ||
3270  (X > 0. + xmargin && X < 1.16 - xmargin && fabs(Y) < 6.85 - ymargin && fabs(Y) > 1.19 + ymargin)
3271  ||
3272  (X > 2.3 + xmargin && X < 3.46 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3273  ||
3274  (X > 4.64 + xmargin && X < 5.8 - xmargin && fabs(Y) < 4.59 - ymargin && fabs(Y) > 0.07 + ymargin)
3275  ) return true;
3276 
3277 
3278 
3279  return false;
3280 }
3281 
3282 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk6_97to6_99withMargin
3283 
3284 
3285 
3286 
3287 
3288 
3289 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk7_41to7_43
3290 
3292  Double_t X, // X coordinate of point;
3293  Double_t Y // Y coordinate of point;
3294  )
3295 {
3296 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3297 // they are placed between 7.41 and 7.43 in Z;
3298 // look at Gianluigi's logbook on page 196 for the geometry detail;
3299 
3300 // this geometry is the mirror-reflected with respect of Y axis of the Z=6.97_6.99 geometry;
3301 
3302  if(
3303  (-X > -6.96 && -X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3304  ||
3305  (-X > -4.64 && -X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3306  ||
3307  (-X > -2.33 && -X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3308  ||
3309  (-X > 0. && -X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3310  ||
3311  (-X > 2.3 && -X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3312  ||
3313  (-X > 4.64 && -X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3314  ) return true;
3315 
3316 
3317 
3318  return false;
3319 }
3320 
3321 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk7_41to7_43
3322 
3323 
3324 
3325 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk7_41to7_43withMargin
3326 
3328  Double_t X, // X coordinate of point;
3329  Double_t Y, // Y coordinate of point;
3330  Double_t xmargin, // safety margin in X coordinate;
3331  Double_t ymargin // safety margin in Y coordinate;
3332  )
3333 {
3334 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3335 // they are placed between 7.41 and 7.43 in Z;
3336 // look at Gianluigi's logbook on page 196 for the geometry detail;
3337 
3338 // this geometry is the mirror-reflected with respect of Y axis of the Z=6.97_6.99 geometry;
3339 
3340 
3341  if(
3342  (-X > -6.96 + xmargin && -X < -5.8 - xmargin && fabs(Y) < 2.31 - ymargin && fabs(Y) > 0.07 + ymargin)
3343  ||
3344  (-X > -4.64 + xmargin && -X < -3.48 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3345  ||
3346  (-X > -2.33 + xmargin && -X < -1.17 - xmargin && fabs(Y) < 6.87 - ymargin && fabs(Y) > 0.07 + ymargin)
3347  ||
3348  (-X > 0. + xmargin && -X < 1.16 - xmargin && fabs(Y) < 6.85 - ymargin && fabs(Y) > 1.19 + ymargin)
3349  ||
3350  (-X > 2.3 + xmargin && -X < 3.46 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3351  ||
3352  (-X > 4.64 + xmargin && -X < 5.8 - xmargin && fabs(Y) < 4.59 - ymargin && fabs(Y) > 0.07 + ymargin)
3353  ) return true;
3354 
3355 
3356 
3357 
3358  return false;
3359 }
3360 
3361 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk7_41to7_43withMargin
3362 
3363 
3364 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk9_97to9_99
3365 
3367  Double_t X, // X coordinate of point;
3368  Double_t Y // Y coordinate of point;
3369  )
3370 {
3371 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3372 // they are placed between 9.97 and 9.99 in Z;
3373 // look at Gianluigi's logbook on page 197 for the geometry detail;
3374 
3375 // this geometry is the mirror-reflected with respect of Y axis of the Z=6.97_6.99 geometry;
3376 
3377  if(
3378  (-X > -6.96 && -X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3379  ||
3380  (-X > -4.64 && -X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3381  ||
3382  (-X > -2.33 && -X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3383  ||
3384  (-X > 0. && -X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3385  ||
3386  (-X > 2.3 && -X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3387  ||
3388  (-X > 4.64 && -X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3389  ) return true;
3390 
3391 
3392 
3393  return false;
3394 }
3395 
3396 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk9_97to9_99
3397 
3398 
3399 
3400 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk9_97to9_99withMargin
3401 
3403  Double_t X, // X coordinate of point;
3404  Double_t Y, // Y coordinate of point;
3405  Double_t xmargin, // safety margin in X coordinate;
3406  Double_t ymargin // safety margin in Y coordinate;
3407  )
3408 {
3409 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3410 // they are placed between 9.97 and 9.99 in Z;
3411 // look at Gianluigi's logbook on page 197 for the geometry detail;
3412 
3413 // this geometry is the mirror-reflected with respect of Y axis of the Z=6.97_6.99 geometry;
3414 
3415 
3416  if(
3417  (-X > -6.96 + xmargin && -X < -5.8 - xmargin && fabs(Y) < 2.31 - ymargin && fabs(Y) > 0.07 + ymargin)
3418  ||
3419  (-X > -4.64 + xmargin && -X < -3.48 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3420  ||
3421  (-X > -2.33 + xmargin && -X < -1.17 - xmargin && fabs(Y) < 6.87 - ymargin && fabs(Y) > 0.07 + ymargin)
3422  ||
3423  (-X > 0. + xmargin && -X < 1.16 - xmargin && fabs(Y) < 6.85 - ymargin && fabs(Y) > 1.19 + ymargin)
3424  ||
3425  (-X > 2.3 + xmargin && -X < 3.46 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3426  ||
3427  (-X > 4.64 + xmargin && -X < 5.8 - xmargin && fabs(Y) < 4.59 - ymargin && fabs(Y) > 0.07 + ymargin)
3428  ) return true;
3429 
3430 
3431 
3432 
3433  return false;
3434 }
3435 
3436 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk9_97to9_99withMargin
3437 
3438 
3439 
3440 
3441 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk10_41to10_43
3442 
3444  Double_t X, // X coordinate of point;
3445  Double_t Y // Y coordinate of point;
3446  )
3447 {
3448 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3449 // they are placed between 10.41 and 10.43 in Z;
3450 // look at Gianluigi's logbook on page 197 for the geometry detail;
3451 
3452 // this geometry is the same as the Z=6.97_6.99 geometry;
3453 
3454  if(
3455  (X > -6.96 && X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3456  ||
3457  (X > -4.64 && X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3458  ||
3459  (X > -2.33 && X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3460  ||
3461  (X > 0. && X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3462  ||
3463  (X > 2.3 && X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3464  ||
3465  (X > 4.64 && X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3466  ) return true;
3467 
3468 
3469  return false;
3470 }
3471 
3472 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk10_41to10_43
3473 
3474 
3475 
3476 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk10_41to10_43withMargin
3477 
3479  Double_t X, // X coordinate of point;
3480  Double_t Y, // Y coordinate of point;
3481  Double_t xmargin, // safety margin in X coordinate;
3482  Double_t ymargin // safety margin in Y coordinate;
3483  )
3484 {
3485 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3486 // they are placed between 10.41 and 10.43 in Z;
3487 // look at Gianluigi's logbook on page 197 for the geometry detail;
3488 
3489 // this geometry is the same as the Z=6.97_6.99 geometry;
3490 
3491  if(
3492  (X > -6.96 + xmargin && X < -5.8 - xmargin && fabs(Y) < 2.31 - ymargin && fabs(Y) > 0.07 + ymargin)
3493  ||
3494  (X > -4.64 + xmargin && X < -3.48 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3495  ||
3496  (X > -2.33 + xmargin && X < -1.17 - xmargin && fabs(Y) < 6.87 - ymargin && fabs(Y) > 0.07 + ymargin)
3497  ||
3498  (X > 0. + xmargin && X < 1.16 - xmargin && fabs(Y) < 6.85 - ymargin && fabs(Y) > 1.19 + ymargin)
3499  ||
3500  (X > 2.3 + xmargin && X < 3.46 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3501  ||
3502  (X > 4.64 + xmargin && X < 5.8 - xmargin && fabs(Y) < 4.59 - ymargin && fabs(Y) > 0.07 + ymargin)
3503  ) return true;
3504 
3505 
3506  return false;
3507 }
3508 
3509 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk10_41to10_43withMargin
3510 
3511 
3512 
3513 
3514 
3515 
3516 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk14_77to14_79
3517 
3519  Double_t X, // X coordinate of point;
3520  Double_t Y // Y coordinate of point;
3521  )
3522 {
3523 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3524 // they are placed between 14.77 and 14.79 in Z;
3525 // look at Gianluigi's logbook on page 198 for the geometry detail;
3526 
3527 // this geometry is the same as the Z=6.97_6.99 geometry;
3528 
3529  if(
3530  (X > -6.96 && X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3531  ||
3532  (X > -4.64 && X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3533  ||
3534  (X > -2.33 && X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3535  ||
3536  (X > 0. && X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3537  ||
3538  (X > 2.3 && X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3539  ||
3540  (X > 4.64 && X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3541  ) return true;
3542 
3543 
3544 
3545  return false;
3546 }
3547 
3548 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk14_77to14_79
3549 
3550 
3551 
3552 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk14_77to14_79withMargin
3553 
3555  Double_t X, // X coordinate of point;
3556  Double_t Y, // Y coordinate of point;
3557  Double_t xmargin, // safety margin in X coordinate;
3558  Double_t ymargin // safety margin in Y coordinate;
3559  )
3560 {
3561 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3562 // they are placed between 14.77 and 14.79 in Z;
3563 // look at Gianluigi's logbook on page 198 for the geometry detail;
3564 
3565 // this geometry is the same as the Z=6.97_6.99 geometry;
3566 
3567  if(
3568  (X > -6.96 + xmargin && X < -5.8 - xmargin && fabs(Y) < 2.31 - ymargin && fabs(Y) > 0.07 + ymargin)
3569  ||
3570  (X > -4.64 + xmargin && X < -3.48 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3571  ||
3572  (X > -2.33 + xmargin && X < -1.17 - xmargin && fabs(Y) < 6.87 - ymargin && fabs(Y) > 0.07 + ymargin)
3573  ||
3574  (X > 0. + xmargin && X < 1.16 - xmargin && fabs(Y) < 6.85 - ymargin && fabs(Y) > 1.19 + ymargin)
3575  ||
3576  (X > 2.3 + xmargin && X < 3.46 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3577  ||
3578  (X > 4.64 + xmargin && X < 5.8 - xmargin && fabs(Y) < 4.59 - ymargin && fabs(Y) > 0.07 + ymargin)
3579  ) return true;
3580 
3581 
3582 
3583  return false;
3584 }
3585 
3586 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk14_77to14_79withMargin
3587 
3588 
3589 
3590 
3591 
3592 
3593 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk15_21to15_23
3594 
3596  Double_t X, // X coordinate of point;
3597  Double_t Y // Y coordinate of point;
3598  )
3599 {
3600 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3601 // they are placed between 15.21 and 15.23 in Z;
3602 // look at Gianluigi's logbook on page 198 for the geometry detail;
3603 
3604 // this geometry is the same as the Z=7.41_7.43 geometry;
3605 
3606  if(
3607  (-X > -6.96 && -X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3608  ||
3609  (-X > -4.64 && -X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3610  ||
3611  (-X > -2.33 && -X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3612  ||
3613  (-X > 0. && -X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3614  ||
3615  (-X > 2.3 && -X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3616  ||
3617  (-X > 4.64 && -X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3618  ) return true;
3619 
3620 
3621 
3622  return false;
3623 }
3624 
3625 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk15_21to15_23
3626 
3627 
3628 
3629 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk15_21to15_23withMargin
3630 
3632  Double_t X, // X coordinate of point;
3633  Double_t Y, // Y coordinate of point;
3634  Double_t xmargin, // safety margin in X coordinate;
3635  Double_t ymargin // safety margin in Y coordinate;
3636  )
3637 {
3638 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3639 // they are placed between 15.21 and 15.23 in Z;
3640 // look at Gianluigi's logbook on page 198 for the geometry detail;
3641 
3642 // this geometry is the same as the Z=7.41_7.43 geometry;
3643 
3644  if(
3645  (-X > -6.96 + xmargin && -X < -5.8 - xmargin && fabs(Y) < 2.31 - ymargin && fabs(Y) > 0.07 + ymargin)
3646  ||
3647  (-X > -4.64 + xmargin && -X < -3.48 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3648  ||
3649  (-X > -2.33 + xmargin && -X < -1.17 - xmargin && fabs(Y) < 6.87 - ymargin && fabs(Y) > 0.07 + ymargin)
3650  ||
3651  (-X > 0. + xmargin && -X < 1.16 - xmargin && fabs(Y) < 6.85 - ymargin && fabs(Y) > 1.19 + ymargin)
3652  ||
3653  (-X > 2.3 + xmargin && -X < 3.46 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3654  ||
3655  (-X > 4.64 + xmargin && -X < 5.8 - xmargin && fabs(Y) < 4.59 - ymargin && fabs(Y) > 0.07 + ymargin)
3656  ) return true;
3657 
3658 
3659 
3660  return false;
3661 }
3662 
3663 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk15_21to15_23withMargin
3664 
3665 
3666 
3667 
3668 
3669 
3670 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk21_77to21_79
3671 
3673  Double_t X, // X coordinate of point;
3674  Double_t Y // Y coordinate of point;
3675  )
3676 {
3677 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3678 // they are placed between 21.77 and 21.79 in Z;
3679 // look at Gianluigi's logbook on page 198 for the geometry detail;
3680 
3681 // this geometry is the same as the Z=7.41_7.43 geometry;
3682 
3683 
3684  if(
3685  (-X > -6.96 && -X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3686  ||
3687  (-X > -4.64 && -X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3688  ||
3689  (-X > -2.33 && -X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3690  ||
3691  (-X > 0. && -X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3692  ||
3693  (-X > 2.3 && -X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3694  ||
3695  (-X > 4.64 && -X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3696  ) return true;
3697 
3698 
3699 
3700 
3701  return false;
3702 }
3703 
3704 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk21_77to21_79
3705 
3706 
3707 
3708 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk21_77to21_79withMargin
3709 
3711  Double_t X, // X coordinate of point;
3712  Double_t Y, // Y coordinate of point;
3713  Double_t /*xmargin*/, //[R.K. 9/2018] unused // safety margin in X coordinate;
3714  Double_t /*ymargin*/ //[R.K. 9/2018] unused // safety margin in Y coordinate;
3715  )
3716 {
3717 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3718 // they are placed between 21.77 and 21.79 in Z;
3719 // look at Gianluigi's logbook on page 198 for the geometry detail;
3720 
3721 
3722 // this geometry is the same as the Z=7.41_7.43 geometry;
3723 
3724 
3725  if(
3726  (-X > -6.96 && -X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3727  ||
3728  (-X > -4.64 && -X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3729  ||
3730  (-X > -2.33 && -X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3731  ||
3732  (-X > 0. && -X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3733  ||
3734  (-X > 2.3 && -X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3735  ||
3736  (-X > 4.64 && -X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3737  ) return true;
3738 
3739 
3740  return false;
3741 }
3742 
3743 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk21_77to21_79withMargin
3744 
3745 
3746 
3747 
3748 
3749 
3750 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk22_21to22_23
3751 
3753  Double_t X, // X coordinate of point;
3754  Double_t Y // Y coordinate of point;
3755  )
3756 {
3757 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3758 // they are placed between 22.21 and 22.23 in Z;
3759 // look at Gianluigi's logbook on page 193 for the geometry detail;
3760 
3761 
3762  if(
3763  (X > -6.96 && X < -5.8 && fabs(Y) < 2.31 && fabs(Y) > 0.07)
3764  ||
3765  (X > -4.64 && X < -3.48 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3766  ||
3767  (X > -2.33 && X < -1.17 && fabs(Y) < 6.87 && fabs(Y) > 0.07)
3768  ||
3769  (X > 0. && X < 1.16 && fabs(Y) < 6.85 && fabs(Y) > 1.19)
3770  ||
3771  (X > 2.3 && X < 3.46 && fabs(Y) < 5.73 && fabs(Y) > 0.07)
3772  ||
3773  (X > 4.64 && X < 5.8 && fabs(Y) < 4.59 && fabs(Y) > 0.07)
3774  ) return true;
3775 
3776 
3777 
3778 
3779  return false;
3780 }
3781 
3782 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk22_21to22_23
3783 
3784 
3785 
3786 //----------begin of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk22_21to22_23withMargin
3787 
3789  Double_t X, // X coordinate of point;
3790  Double_t Y, // Y coordinate of point;
3791  Double_t xmargin, // safety margin in X coordinate;
3792  Double_t ymargin // safety margin in Y coordinate;
3793  )
3794 {
3795 // this is a set of sensors placed vertically perpendicularly to the Z direction;
3796 // they are placed between 22.21 and 22.23 in Z;
3797 // look at Gianluigi's logbook on page 193 for the geometry detail;
3798 
3799 
3800  if(
3801  (X > -6.96 + xmargin && X < -5.8 - xmargin && fabs(Y) < 2.31 - ymargin && fabs(Y) > 0.07 + ymargin)
3802  ||
3803  (X > -4.64 + xmargin && X < -3.48 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3804  ||
3805  (X > -2.33 + xmargin && X < -1.17 - xmargin && fabs(Y) < 6.87 - ymargin && fabs(Y) > 0.07 + ymargin)
3806  ||
3807  (X > 0. + xmargin && X < 1.16 - xmargin && fabs(Y) < 6.85 - ymargin && fabs(Y) > 1.19 + ymargin)
3808  ||
3809  (X > 2.3 + xmargin && X < 3.46 - xmargin && fabs(Y) < 5.73 - ymargin && fabs(Y) > 0.07 + ymargin)
3810  ||
3811  (X > 4.64 + xmargin && X < 5.8 - xmargin && fabs(Y) < 4.59 - ymargin && fabs(Y) > 0.07 + ymargin)
3812  ) return true;
3813 
3814 
3815 
3816 
3817  return false;
3818 }
3819 
3820 //----------end of function PndTrkCTGeometryCalculations::IsInMvdMiniDisk22_21to22_23withMargin
3821 
3822 
3823 
3824 
3825 //----------end of function PndTrkCTGeometryCalculations::IsInTargetPipe
3826 
3828  Double_t Oxx,
3829  Double_t Oyy,
3830  Double_t Rr,
3831  Double_t fi0,
3832  Double_t kappa,
3833  Short_t Charge,
3834  Double_t gap
3835  )
3836 {
3837  Short_t nintersections;
3838 
3839  Double_t delta,
3840  XintersectionList[8],
3841  YintersectionList[8],
3842  Xcross[2],
3843  Ycross[2];
3844 
3845  // find if this track lays in the target pipe volume
3846  // for distances < 15 (supposidly the maximum radius of the Mvd system)
3847  // and consequently it cannot have Mvd hits.
3848 
3849  nintersections=0;
3850 
3851  // intersections of trajectory with plane X = gap;
3852  delta = Rr*Rr - (gap-Oxx)*(gap-Oxx);
3853  if(delta>0.) {
3854  XintersectionList[0] = gap;
3855  YintersectionList[0] = sqrt(delta) + Oyy;
3856  XintersectionList[1] = gap;
3857  YintersectionList[1] = -sqrt(delta) + Oyy;
3858  nintersections+=2;
3859  }
3860 
3861  // intersections of trajectory with plane X = -gap;
3862  delta = Rr*Rr - (-gap-Oxx)*(-gap-Oxx);
3863  if(delta>0.) {
3864  XintersectionList[nintersections] = -gap;
3865  YintersectionList[nintersections] = sqrt(delta) + Oyy;
3866  XintersectionList[nintersections+1] = -gap;
3867  YintersectionList[nintersections+1] = -sqrt(delta) + Oyy;
3868  nintersections+=2;
3869  }
3870 
3871 
3872  // intersections of trajectory with plane Z = gap;
3873  XintersectionList[nintersections] = Oxx + Rr*cos(fi0+kappa*gap);
3874  YintersectionList[nintersections] = Oyy + Rr*sin(fi0+kappa*gap);
3875  nintersections++;
3876 
3877  // intersections of trajectory with plane Z = -gap;
3878  XintersectionList[nintersections] = Oxx + Rr*cos(fi0-kappa*gap);
3879  YintersectionList[nintersections] = Oyy + Rr*sin(fi0-kappa*gap);
3880  nintersections++;
3881 
3882  // order the found intersection point by increasing/decreasing FI
3883  // depending if the Charge is negative or positive.
3884  ChooseEntranceExitbis(
3885  Oxx,
3886  Oyy,
3887  Charge,
3888  fi0,
3889  nintersections,// n. intersection in input.
3890  XintersectionList,
3891  YintersectionList,
3892  Xcross, // output
3893  Ycross // output
3894  );
3895 
3896  // here I suppose that the Mvd system CONSERVATIVELY ends at Rmax=5 cm.
3897 //---------------
3898 for(int ic=0;ic<nintersections;ic++){
3899 }
3900 //-------------
3901  if( fabs(Ycross[0]) > 4. ) return true;
3902  else return false;
3903 }
3904 //----------end of function PndTrkCTGeometryCalculations::IsInTargetPipe
3905 
3906 
3907 //----------star of function PndTrkCTGeometryCalculations::IsInternal
3908 
3910  Double_t Px, // point
3911  Double_t Py,
3912  Double_t Xtraslation,
3913  Double_t Ytraslation,
3914  Double_t Theta
3915  )
3916 {
3917 
3918 
3919  // for explanations see Gianluigi's logbook on page 278-280.
3920 
3921  if( (Xtraslation-Px)*sin(Theta) + (Py-Ytraslation)*cos(Theta) >= 0. ) return true;
3922  else return false;
3923 
3924 
3925 }
3926 
3927 
3928 
3929 //----------end of function PndTrkCTGeometryCalculations::IsInternal
3930 
3931 
3932 
3933 
3934 //----------begin of function PndTrkCTGeometryCalculations::ListAxialSectorsCrossedbyTrack_and_Hits
3935 
3937  Double_t Ox, // input;
3938  Double_t Oy, // input;
3939  Double_t R, // input;
3940  Double_t Charge, // input;
3941  Short_t nHits, // input;
3942  Short_t* ListHits, // input;
3943  Double_t info[][7], // input;
3944  Short_t & nArcs_populated, // output; # Arcs of trajectory populated by at least 1 axial hit; this is <= 56;
3945  Short_t nHitsInArc[56], // output; number of hits in each Sector; if the maximun # of Intersected Sector is 56,
3946  // than the maximum # of Arcs is 28;
3947 
3948  Short_t (* ListHitsInArc) [56] // output; ordered list of hits in each Arc (from first to last
3949  // according to the charge of the particle;if the maximum
3950  // # of Intersected Sector is 56, than the maximum # of Arcs is 28;
3951  )
3952 {
3953 
3954 
3955  // nIntersection = number of sectors (entrance/exit) crossed by TRAJECTORY, namely by the entire
3956  // circle projection of the helix on XY;
3957  // nArcs = nIntersection/2 --> this is the number of Arcs in which the circle is segmented by the various
3958  // sectors of the axial straws;
3959  // nArcs_populated = the same as nArcs, but only those Arcs in which axial STT hits are actually present;
3960 
3961 
3962  Short_t
3963  half,
3964  i,
3965  //ihit, //[R.K. 01/2017] unused variable?
3966  //j, //[R.K. 01/2017] unused variable?
3967  jArc,
3968  n,
3969  nArcs,
3970  nIntersections,
3971  oldArc,
3972  remainder;
3973 
3974  Double_t
3975  AllFiOrderedList[56],
3976  AllXOrderedList[56],
3977  AllYOrderedList[56],
3978  fi,
3979  FiStart,
3980  Start[3];
3981  //FiOrderedList12[12], //[R.K. 01/2017] unused variable? // at most 12 intersections; ordered according to charge of the track
3982  // assuming it originated from (0,0,0);
3983  //FiOrderedList16[16]; //[R.K. 01/2017] unused variable? // at most 16 intersections; ordered according to charge of the track
3984  // assuming it originated from (0,0,0);
3985 
3986 
3987 
3988 //Double_t
3989  //XintersectionList12[12], // at most 12 intersections; //[R.K. 01/2017] unused variable?
3990  //XintersectionList16[16], // at most 16 intersections; //[R.K. 01/2017] unused variable?
3991  //YintersectionList12[12], // at most 12 intersections; //[R.K. 01/2017] unused variable?
3992  //YintersectionList16[16]; // at most 16 intersections; //[R.K. 01/2017] unused variable?
3993 
3994 
3995 
3996 
3997  // origin of the track assumed in (0,0,0);
3998  Start[0]=Start[1]=Start[2]= 0.;
3999 
4000 
4001 
4002  // Sector number convention:
4003  // 1 --> Right Axial Outer;
4004  // 2 --> Right Axial Inner;
4005  // 3 --> Left Axial Inner;
4006  // 4 --> Left Axial Outer;
4007 
4008 
4009  nArcs=0;
4010 
4011  // Sector 1;
4012  nIntersections = FindTrackEntranceExitHexagonCircleRight2(
4013  Ox,
4014  Oy,
4015  R,
4016  Charge,
4017  Start,
4020  VERTICALGAP,
4021  &AllXOrderedList[0],
4022  &AllYOrderedList[0],
4023 // AllXOrderedList,
4024 // AllYOrderedList,
4025  AllFiOrderedList
4026  );
4027 
4028  // nIntersections must be multiple of 2 (entrance/exit);
4029  // each pair entrance/exit defines an arc of the trajectory; each arc will be later analyzed for continuity;
4030  half = nIntersections/2;
4031  remainder = nIntersections - 2 * half; // this is like fmod, only for integer arguments;
4032  //------
4033 
4034  if( remainder != 0 ){
4035  cout<<"PndTrkCTGeometryCalculations::ListAxialSectorsCrossedbyTrack_and_Hits,after FindTrackEntranceExitHexagonCircleRight2;"
4036  <<"\n\todd number of intersections : "<<nIntersections<<", cannot be, return with nArcs_populated=0!\n";
4037  nArcs_populated=0;
4038  return;
4039  }
4040  //------
4041 
4042 
4043 
4044  nArcs += half;
4045 
4046 /*
4047  for(i=0;i<nIntersections;i++){
4048  cout<<"from PndTrkCTGeometryCalculations, 1; Inters. so far "<<nIntersections<<", X inter "<<AllXOrderedList[i]<<", Y inter "
4049  <<AllYOrderedList[i]<<endl;
4050  };
4051 */
4052 
4053  // Sector 2;
4054  n = FindTrackEntranceExitbiHexagonRight2(
4055  VERTICALGAP,
4056  Ox,
4057  Oy,
4058  R,
4059  Charge,
4060  Start,
4063  &AllXOrderedList[nIntersections],
4064  &AllYOrderedList[nIntersections],
4065  &AllFiOrderedList[nIntersections]
4066  );
4067 
4068  // n must be multiple of 2 (entrance/exit);
4069  // each pair entrance/exit defines an arc of the trajectory; each arc will be later analyzed for continuity;
4070  half = n/2;
4071  remainder = n - 2 * half; // this is like fmod, only for integer arguments;
4072  //------
4073  if( remainder != 0 ){
4074  cout<<"PndTrkCTGeometryCalculations::ListAxialSectorsCrossedbyTrack_and_Hits,after FindTrackEntranceExitbiHexagonRight2;"
4075  <<"\n\todd number of intersections : "<<n<<", cannot be, return with nArcs_populated=0!\n";
4076  nArcs_populated=0;
4077  return;
4078  }
4079  //------
4080 
4081  nIntersections += n;
4082 
4083  nArcs += half;
4084 
4085 /* for(i=0;i<nIntersections;i++){ cout<<"from PndTrkCTGeometryCalculations, 2; Inters. so far "<<
4086 nIntersections<<", X inter "<<AllXOrderedList[i]<<", Y inter "
4087  <<AllYOrderedList[i]<<endl;};
4088 */
4089 
4090  // Sector 3;
4091  n = FindTrackEntranceExitbiHexagonLeft2(
4092  VERTICALGAP,
4093  Ox,
4094  Oy,
4095  R,
4096  Charge,
4097  Start,
4100  &AllXOrderedList[nIntersections],
4101  &AllYOrderedList[nIntersections],
4102  &AllFiOrderedList[nIntersections]
4103  );
4104  // n must be multiple of 2 (entrance/exit);
4105  // each pair entrance/exit defines an arc of the trajectory; each arc will be later analyzed for continuity;
4106  half = n/2;
4107  remainder = n - 2 * half; // this is like fmod, only for integer arguments;
4108  //------
4109  if( remainder != 0 ){
4110  cout<<"PndTrkCTGeometryCalculations::ListAxialSectorsCrossedbyTrack_and_Hits,after FindTrackEntranceExitbiHexagonLeft2;"
4111  <<"\n\todd number of intersections : "<<n<<", cannot be, return with nArcs_populated=0!\n";
4112  nArcs_populated=0;
4113  return;
4114  }
4115  //------
4116 
4117  nArcs += half;
4118 
4119 
4120 
4121 // for(i=nIntersections;i<nIntersections+n;i++){ IntersectedSector[i]=3;};
4122  nIntersections += n;
4123 
4124 /* for(i=0;i<nIntersections;i++){ cout<<"from PndTrkCTGeometryCalculations, 3, Inters. so far "<<
4125 nIntersections<<", X inter "<<AllXOrderedList[i]<<", Y inter "
4126  <<AllYOrderedList[i]<<endl;};
4127 */
4128 
4129  // Sector 4;
4130  n = FindTrackEntranceExitHexagonCircleLeft2(
4131  Ox,
4132  Oy,
4133  R,
4134  Charge,
4135  Start,
4138  VERTICALGAP,
4139  &AllXOrderedList[nIntersections],
4140  &AllYOrderedList[nIntersections],
4141  &AllFiOrderedList[nIntersections]
4142  );
4143  // n must be multiple of 2 (entrance/exit);
4144  // each pair entrance/exit defines an arc of the trajectory; each arc will be later analyzed for continuity;
4145  half = n/2;
4146  remainder = n - 2 * half; // this is like fmod, only for integer arguments;
4147  //------
4148  if( remainder != 0 ){
4149  cout<<"PndTrkCTGeometryCalculations::ListAxialSectorsCrossedbyTrack_and_Hits,after FindTrackEntranceExitHexagonCircleLeft2;"
4150  <<"\n\todd number of intersections : "<<n<<", cannot be, return with nArcs_populated=0!\n";
4151  nArcs_populated=0;
4152  return;
4153  }
4154  //------
4155 
4156  nArcs += half;
4157 
4158 
4159  nIntersections += n;
4160 
4161 /* for(i=0;i<nIntersections;i++){ cout<<"from PndTrkCTGeometryCalculations, 4, Inters. so far "<<nIntersections<<
4162 ", X inter "<<AllXOrderedList[i]<<", Y inter "
4163  <<AllYOrderedList[i]<<endl;};
4164 */
4165 
4166  // now subdivide the hit list in many lists, on for each sector crossed by track;
4167  // since the List of Hits in a track should already be ordered from inside
4168  // outwards, the various ListHitsInArc[*][jArc] should be automatically
4169  // ordered from inside outwards; also the various Arcs shoud be already in the right sequence
4170  // from inside towards outside;
4171 
4172  FiStart = atan2( Start[1]-Oy,Start[0]-Ox);
4173  if(FiStart<0.) FiStart+= TWO_PI;
4174  if(FiStart<0.) FiStart =0.;
4175 
4176  oldArc = -1;
4177  nArcs_populated=0;
4178 
4179  if(Charge > 0.) { // particle runs clockwise;
4180  // loop over the hits in track;
4181  for(i=0;i<nHits;i++){
4182  fi = atan2(info[ListHits[i]][1]-Oy, info[ListHits[i]][0]-Ox);
4183  if(fi<0.) fi+= TWO_PI;
4184  if(fi<0.) fi =0.;
4185  if( fi > FiStart) fi -= TWO_PI;
4186  if( fi > FiStart) fi = FiStart;
4187  // find to which Arc this hit belongs;
4188  for(jArc=0;jArc<nArcs;jArc++){
4189  if(fi < AllFiOrderedList[2*jArc] && fi>AllFiOrderedList[2*jArc+1])
4190  {
4191  if( jArc != oldArc ){ // new Arc;
4192  oldArc=jArc;
4193  nHitsInArc[nArcs_populated] = 1;
4194  ListHitsInArc[0][nArcs_populated ] = ListHits[i];
4195  nArcs_populated++;
4196  } else {
4197  ListHitsInArc[ nHitsInArc[nArcs_populated-1] ][ nArcs_populated-1 ] = ListHits[i];
4198  nHitsInArc[ nArcs_populated-1 ] ++;
4199  } // end of if( jArc != oldArc )
4200 
4201  break;
4202  } // end of if(fi < AllFiOrderedList[2*jArc] && fi>AllFiOrderedList[2*jArc+1])
4203  } // end of for(j=0;j<nIntersections;j++)
4204  } // end of for(i=0;i<nHits;i++)
4205 
4206  } else { // continuation of if(charge > 0.) // negative particle run anticlockwise;
4207 
4208 
4209  // loop over the hits in track;
4210  for(i=0;i<nHits;i++){
4211  fi = atan2(info[ListHits[i]][1]-Oy, info[ListHits[i]][0]-Ox);
4212  if(fi<0.) fi+= TWO_PI;
4213  if(fi<0.) fi =0.;
4214  if( fi < FiStart) fi += TWO_PI;
4215  if( fi < FiStart) fi = FiStart;
4216  // find to which Arc this hit belongs;
4217  for(jArc=0;jArc<nArcs;jArc++){
4218  if(fi > AllFiOrderedList[2*jArc] && fi < AllFiOrderedList[2*jArc+1])
4219  {
4220  if( jArc != oldArc ){ // new Arc;
4221  oldArc=jArc;
4222  nHitsInArc[nArcs_populated] = 1;
4223  ListHitsInArc[0][nArcs_populated ] = ListHits[i];
4224  nArcs_populated++;
4225  } else {
4226  ListHitsInArc[ nHitsInArc[nArcs_populated-1] ][ nArcs_populated-1 ] = ListHits[i];
4227  nHitsInArc[ nArcs_populated-1 ] ++;
4228  } // end of if( jArc != oldArc )
4229 
4230  break;
4231  } // end of if(fi < AllFiOrderedList[2*jArc] && fi>AllFiOrderedList[2*jArc+1])
4232  } // end of for(j=0;j<nIntersections;j++)
4233  } // end of for(i=0;i<nHits;i++)
4234 
4235 
4236  } // end of if(charge > 0.)
4237 
4238 
4239  return;
4240 }
4241 
4242 
4243 //----------end of function PndTrkCTGeometryCalculations::ListAxialSectorsCrossedbyTrack_and_Hits
4244 
4245 
4246 
4247 
4248 
4249 
4250 
4251 
4252 
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
const Double_t RSTRAWDETECTORMAX
bool IsInMvdMiniDisk6_97to6_99(Double_t X, Double_t Y)
const Double_t STRAWRESOLUTION
bool IsInMvdMiniDisk9_97to9_99withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
bool IsInternal(Double_t Px, Double_t Py, Double_t Xtraslation, Double_t Ytraslation, Double_t Theta)
void FindingParallelTrackAngularRange(Double_t oX, Double_t oY, Double_t Rr, Short_t Charge, Double_t *Fi_low_limit, Double_t *Fi_up_limit, Short_t *status, Double_t Rmin, Double_t Rmax)
void ListAxialSectorsCrossedbyTrack_and_Hits(Double_t Ox, Double_t Oy, Double_t R, Double_t Charge, Short_t nHits, Short_t *ListHits, Double_t info[][7], Short_t &nArcs_populated, Short_t nHitsInArc[56], Short_t(*ListHitsInArc)[56])
Short_t IntersectionsWithClosedPolygon(Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t Rmi, Double_t Rma, Short_t nIntersections[2], Double_t XintersectionList[][2], Double_t YintersectionList[][2])
TObjArray * d
Short_t IntersectionsWithClosedbiHexagonLeft(Double_t vgap, Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t Ami, Double_t Ama, Short_t *nIntersections, Double_t *XintersectionList, Double_t *YintersectionList)
Short_t FindTrackEntranceExitHexagonCircleLeft2(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t GAP, Double_t XintersectionList[12], Double_t YintersectionList[12], Double_t FiOrderedList[12])
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
TTree * b
TF1 * f1
Definition: reco_analys2.C:50
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Short_t IntersectionsWithClosedbiHexagonRight(Double_t vgap, Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t Ami, Double_t Ama, Short_t *nIntersections, Double_t *XintersectionList, Double_t *YintersectionList)
bool IsInTargetPipe(Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t fi0, Double_t kappa, Short_t charge, Double_t gap)
void ChooseEntranceExit3(Double_t Oxx, Double_t Oyy, Short_t Charge, Double_t FiStart, Short_t nIntersections, Double_t *XintersectionList, Double_t *YintersectionList, Double_t *FiOrderedList)
void CalculateSandZ(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t skewnum, Double_t info[][7], Double_t *WDX, Double_t *WDY, Double_t *WDZ, Double_t S[2], Double_t Z[2], Double_t Zdrift[2], Double_t Zerror[2])
bool IsInMvdMiniDisk6_97to6_99withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
Double_t Dist_SZ(Double_t Rr, Double_t KAPPA, Double_t FI0, Double_t ZED, Double_t S, Int_t *nrounds)
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
bool IsInMvdMiniDisk10_41to10_43(Double_t X, Double_t Y)
int n
bool IsInMvdMiniDisk2_41to2_43withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
Short_t FindTrackEntranceExitHexagonCircleLeft(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t GAP, Double_t Xcross[2], Double_t Ycross[2])
timer Start()
bool IsInMvdMiniDisk9_97to9_99(Double_t X, Double_t Y)
double Y
Definition: anaLmdDigi.C:68
bool IsInMvdMiniDisk21_77to21_79withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
bool IsInMvdMiniDisk7_41to7_43withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
bool IsInMvdMiniDisk14_77to14_79(Double_t X, Double_t Y)
Double_t Dist_SZ_bis(Double_t Rr, Double_t KAPPA, Double_t FI0, Double_t ZED, Double_t S, Short_t n_allowed_rounds, Double_t signPz, Double_t &chosenS)
void ChooseEntranceExitbis(Double_t Oxx, Double_t Oyy, Short_t Charge, Double_t FiStart, Short_t nIntersections, Double_t *XintersectionList, Double_t *YintersectionList, Double_t Xcross[2], Double_t Ycross[2])
bool IntersectionCircle_Segment_forScitil(Double_t a, Double_t b, Double_t c, Double_t P1x, Double_t P2x, Double_t P1y, Double_t P2y, Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t factor, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
bool IsInMvdMiniDisk15_21to15_23withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
const Double_t TWO_PI
Int_t a
Definition: anaLmdDigi.C:126
const Double_t SEMILENGTH_STRAIGHT
int nHits
Definition: RiemannTest.C:16
TFile * fi
Double_t
bool CalculateCircleThru3Points(Double_t x1, Double_t y1, Double_t x2, Double_t y2, Double_t x3, Double_t y3, Double_t *o_x, Double_t *o_y, Double_t *r_r)
bool IsInMvdMiniDisk1_97to1_99withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
bool IsInMvdMiniDisk22_21to22_23(Double_t X, Double_t Y)
const Double_t APOTEMAMINOUTERPARSTRAW
bool IsInMvdMiniDisk21_77to21_79(Double_t X, Double_t Y)
TFile * f
Definition: bump_analys.C:12
bool IsInMvdMiniDisk14_77to14_79withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static int is
Definition: ranlxd.cxx:374
bool IsInsideArc(Double_t Oxx, Double_t Oyy, Short_t Charge, Double_t Xcross[2], Double_t Ycross[2], Double_t Spoint)
Short_t IntersectionsWithOpenPolygon(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t nSides, Double_t *a, Double_t *b, Double_t *c, Double_t *side_x, Double_t *side_y, Double_t *XintersectionList, Double_t *YintersectionList)
void CalculateSandZ2(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t skewnum, Double_t info[][7], Double_t *WDX, Double_t *WDY, Double_t *WDZ, Double_t S[2], Double_t Sdrift[2], Double_t Z[2], Double_t Zdrift[2], Double_t Zerror[2])
const Double_t VERTICALGAP
bool IntersectionCircle_Segment(Double_t a, Double_t b, Double_t c, Double_t P1x, Double_t P2x, Double_t P1y, Double_t P2y, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
void Merge_Sort(Short_t n_ele, Double_t *array, Int_t *ind)
Short_t FindTrackEntranceExitbiHexagonRight2(Double_t vgap, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t XintersectionList[16], Double_t YintersectionList[16], Double_t FiOrderedList[16])
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
double X
Definition: anaLmdDigi.C:68
Double_t FindDistance(Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t tanlow, Double_t tanmid, Double_t tanup, Double_t alfa, Double_t beta, Double_t gamma)
const Double_t APOTEMAMAXINNERPARSTRAW
Short_t FindTrackEntranceExitbiHexagonLeft2(Double_t vgap, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t XintersectionList[16], Double_t YintersectionList[16], Double_t FiOrderedList[16])
bool IsInMvdMiniDisk4_41to4_43(Double_t X, Double_t Y)
Short_t FindTrackEntranceExitHexagonCircleRight2(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t GAP, Double_t XintersectionList[12], Double_t YintersectionList[12], Double_t FiOrderedList[12])
Double_t x
Short_t FindTrackEntranceExitHexagonCircleRight(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t GAP, Double_t Xcross[2], Double_t Ycross[2])
TFile * f2
bool IsInMvdMiniDisk2_41to2_43(Double_t X, Double_t Y)
bool IntersectionSciTil_Circle(Double_t posizSciTilx, Double_t posizSciTily, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2])
bool IsInMvdMiniDisk7_41to7_43(Double_t X, Double_t Y)
ClassImp(PndAnaContFact)
bool IsInMvdMiniDisk15_21to15_23(Double_t X, Double_t Y)
double Z
Definition: anaLmdDigi.C:68
bool IsInMvdMiniDisk3_97to3_99withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
Short_t FindIntersectionsOuterCircle(Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t RMax, Double_t Xcross[2], Double_t Ycross[2])
Double_t CalculateArcLength(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t *Xcross, Double_t *Ycross)
Short_t IntersectionsWithGapSemicircle(Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t gap, bool left, Double_t Rma, Double_t *XintersectionList, Double_t *YintersectionList)
Short_t FindTrackEntranceExitbiHexagonLeft(Double_t vgap, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t Xcross[2], Double_t Ycross[2])
Double_t y
Short_t FindTrackEntranceExitbiHexagonRight(Double_t vgap, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t ApotemaMin, Double_t ApotemaMax, Double_t Xcross[2], Double_t Ycross[2])
void calculateintersections(Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t C0x, Double_t C0y, Double_t C0z, Double_t r, Double_t vx, Double_t vy, Double_t vz, Int_t *STATUS, Double_t *POINTS)
bool IsInMvdMiniDisk22_21to22_23withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
void FindingParallelTrackAngularRange2(Double_t oX, Double_t oY, Double_t Rma, Double_t Rmi, Double_t Rr, Double_t *Fi_low_limit, Double_t *Fi_up_limit, Short_t *status)
const Double_t APOTEMASTRAWDETECTORMIN
bool IsInMvdMiniDisk4_41to4_43withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
Double_t R
Definition: checkhelixhit.C:61
bool IsInMvdMiniDisk1_97to1_99(Double_t X, Double_t Y)
bool IsInMvdMiniDisk3_97to3_99(Double_t X, Double_t Y)
const Double_t ZCENTER_STRAIGHT
int status[10]
Definition: f_Init.h:28
bool IsInMvdMiniDisk10_41to10_43withMargin(Double_t X, Double_t Y, Double_t xmargin, Double_t ymargin)
const Double_t DIMENSIONSCITIL