FairRoot/PandaRoot
Public Member Functions | List of all members
PndTrkCTFindTrackInXY Class Reference

#include <PndTrkCTFindTrackInXY.h>

Inheritance diagram for PndTrkCTFindTrackInXY:

Public Member Functions

 PndTrkCTFindTrackInXY ()
 
 ~PndTrkCTFindTrackInXY ()
 
bool AcceptHitsConformal (Double_t distance, Double_t DriftConfR, Double_t StrawConfR)
 
Short_t AssociateSciTilHit (Double_t dimensionscitil, Double_t *esse, bool *InclusionListSciTil, Short_t *List, Short_t maxscitilhitsintrack, Short_t nSciTilHits, Double_t Oxx, Double_t Oyy, Double_t posizSciTil[][3], Double_t Rr)
 
void FindCharge (Double_t oX, Double_t oY, Short_t nHits, Double_t *X, Double_t *Y, Short_t *Charge)
 
bool FindTrackInXYProjection (struct FindTrackInXYProjection_InputData *inputdata)
 
Short_t FindTrackPatterninBoxConformal (Short_t *FiConformalIndex, Short_t *HitsinBoxConformal, Short_t ihit, bool *InclusionListStt, Double_t info[][7], Short_t *ListHitsinTrack, Short_t *ListSttParHits, Short_t maxstthitsintracks, Short_t maxstthits, Short_t minimumhitspertrack, Short_t *nBoxConformal, Short_t nfidivconformal, Short_t nFicell, Short_t NFiCELLDISTANCE, Short_t Nparal, Short_t nRcell, Short_t NRCELLDISTANCE, Short_t *RConformalIndex, Short_t nrdivconformal)
 
Short_t FindTrackPatterninBoxConformalSpecial (Short_t *FiConformalIndex, Short_t *HitsinBoxConformal, bool *InclusionListStt, Double_t info[][7], Short_t iSeed, Short_t *ListHitsinTrackinWhichToSearch, Short_t *ListSttParHits, Short_t maxstthits, Short_t minimumhitspertrack, Short_t *nBoxConformal, Short_t NFiCELLDISTANCE, Short_t nfidivconformal, Short_t Nparal, Short_t NparallelToSearch, Short_t NRCELLDISTANCE, Short_t nrdivconformal, Short_t *OutputListHitsinTrack, Short_t *RConformalIndex)
 
Short_t FindTrackStrictCollection (Short_t *FiConformalIndex, bool *InclusionListStt, Short_t iSeed, Short_t *ListHitsinTrackinWhichToSearch, Short_t MAXSTTHITS, Short_t NFiCELLDISTANCE, Short_t nfidivconformal, Short_t NParallelToSearch, Short_t *OutputListHitsinTrack)
 
void OrderingParallel (Short_t Charge, Double_t *Fi_initial_helix_referenceframe, Double_t *Fi_final_helix_referenceframe, Double_t info[][7], Short_t *ListParallelHits, Short_t nParallelHits, Double_t oX, Double_t oY, Double_t *U, Double_t *V)
 
Short_t TrkAssociatedParallelHitsToHelixQuater (Short_t *auxListHitsinTrack, Double_t deltanr, Short_t *FiConformalIndex, Short_t *HitsinBoxConformal, bool *InclusionListStt, Double_t info[][7], Double_t infoparalConformal[][5], Short_t *ListHitsinTrack, Double_t m, Short_t MAXSTTHITS, Short_t *nBoxConformal, Short_t nfidivconformal, Short_t nHitsinTrack, Int_t NhitsParallel, Short_t nrdivconformal, Double_t Oxx, Double_t Oyy, Double_t q, Double_t *radiaConf, Short_t *RConformalIndex, Double_t Rr, Double_t rstrawdetectormin, Short_t Status, Double_t strawradius)
 
Short_t TrkAssociatedParallelHitsToHelix5 (Short_t *auxListHitsinTrack, bool *InclusionListStt, Double_t Fi_low, Double_t Fi_up, Double_t info[][7], Short_t *ListSttParHits, Int_t NhitsParallel, Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t strawradius)
 
 ClassDef (PndTrkCTFindTrackInXY, 1)
 

Detailed Description

Definition at line 64 of file PndTrkCTFindTrackInXY.h.

Constructor & Destructor Documentation

PndTrkCTFindTrackInXY::PndTrkCTFindTrackInXY ( )
inline

Default constructor

Definition at line 71 of file PndTrkCTFindTrackInXY.h.

71 {};
PndTrkCTFindTrackInXY::~PndTrkCTFindTrackInXY ( )
inline

Destructor

Definition at line 75 of file PndTrkCTFindTrackInXY.h.

75 {};

Member Function Documentation

bool PndTrkCTFindTrackInXY::AcceptHitsConformal ( Double_t  distance,
Double_t  DriftConfR,
Double_t  StrawConfR 
)

Definition at line 19 of file PndTrkCTFindTrackInXY.cxx.

References fabs().

24 {
25  if( fabs(distance-DriftConfR) < 2.*StrawConfR ) return true;
26  return false;
27 
28 
29 }
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
Short_t PndTrkCTFindTrackInXY::AssociateSciTilHit ( Double_t  dimensionscitil,
Double_t esse,
bool *  InclusionListSciTil,
Short_t *  List,
Short_t  maxscitilhitsintrack,
Short_t  nSciTilHits,
Double_t  Oxx,
Double_t  Oyy,
Double_t  posizSciTil[][3],
Double_t  Rr 
)

Definition at line 40 of file PndTrkCTFindTrackInXY.cxx.

References atan2(), Double_t, PndTrkCTGeometryCalculations::IntersectionSciTil_Circle(), CAMath::Nint(), and PI.

52 {
53 
54  bool intersect;
55 
56  Short_t
57  igoodScit,
58  iScitHit,
59  Nint;
60 
61  Double_t
62  XintersectionList[2],
63  YintersectionList[2];
64 
65 
66  PndTrkCTGeometryCalculations GeomCalculator;
67 
68 
69  igoodScit=0;
70  for(iScitHit=0; iScitHit<nSciTilHits; iScitHit++){
71  if(!InclusionListSciTil[iScitHit]) continue;
72 
73  intersect=GeomCalculator.IntersectionSciTil_Circle(
74 // dimensionscitil,
75  posizSciTil[iScitHit][0],
76  posizSciTil[iScitHit][1],
77  Oxx,
78  Oyy,
79  Rr,
80  &Nint, // output
81  XintersectionList, // output
82  YintersectionList // output
83  );
84 
85  if(intersect){
86  if( igoodScit == maxscitilhitsintrack) break;
87  List[igoodScit] = iScitHit;
88 
89  // calculate S on the lateral face of the Helix.
90  if ( Nint==1){ // the majority of the cases
91  esse[igoodScit] = atan2(YintersectionList[0]-Oyy,
92  XintersectionList[0]-Oxx);
93  } else { // in this case Nint=2 (it should be a very rare case).
94  // do an average of the two positions.
95  esse[igoodScit] = atan2( 0.5*(YintersectionList[0]+
96  YintersectionList[1])-Oyy,
97  0.5*(XintersectionList[0]+
98  XintersectionList[1])-Oxx);
99  } // end of if ( Nint==1)
100  if ( esse[igoodScit]<0.) esse[igoodScit] += 2.*PI;
101  igoodScit++;
102 
103  } // end of if(intersect && distance<olddist)
104  } // end of for(iScitHit=0; iScitHit<nScitHits; iScitHit++)
105 
106  return igoodScit;
107 
108 }
Double_t
#define PI
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
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])
int Nint(float x)
Definition: PndCAMath.h:117
PndTrkCTFindTrackInXY::ClassDef ( PndTrkCTFindTrackInXY  ,
 
)
void PndTrkCTFindTrackInXY::FindCharge ( Double_t  oX,
Double_t  oY,
Short_t  nHits,
Double_t X,
Double_t Y,
Short_t *  Charge 
)

Definition at line 114 of file PndTrkCTFindTrackInXY.cxx.

References Double_t.

122 {
123 
124  Short_t ihit,
125  nleft,
126  nright;
127 
128  Double_t cross,
129  minl,
130  minr;
131 
132 
133  // this methods works with the hypothesis that this track comes
134  // from (0,0)
135 
136  for(ihit=0, nleft=0, nright=0, minr = 9999999., minl = 9999999.; ihit<nParallelHits; ihit++){
137  // find the Z component of the cross product between the vector from (0,0) to center of
138  // circular trajectory [namely, (oX,oY) ] and the Position vector of the center of the
139  // parallel Hits [namely, (x,y)].
140 
141  cross = oX*Y[ihit] -
142  oY*X[ihit];
143 
144  // if cross >0 hits stays 'on the left' (which means clockwise to go from the origin
145  // to the hit following the smaller path) otherwise it stays 'on the right'.
146 
147  if (cross>0.) {
148  nleft++;
149  } else {
150  nright++;
151  }
152  } // end of for(ihit=0, nleft=0, nright=0;....
153 
154  if( nright> nleft) {
155  *Charge = -1;
156  } else if ( nleft > nright) {
157  *Charge = 1;
158  } else { // then choose according the closest hit ti the center
159  if( minr < minl ) *Charge = -1;
160  else *Charge = 1;
161  }
162 
163 
164 
165 }
double Y
Definition: anaLmdDigi.C:68
Double_t
double X
Definition: anaLmdDigi.C:68
bool PndTrkCTFindTrackInXY::FindTrackInXYProjection ( struct FindTrackInXYProjection_InputData inputdata)

Definition at line 172 of file PndTrkCTFindTrackInXY.cxx.

References FindTrackInXYProjection_InputData::ALFA, FindTrackInXYProjection_InputData::apotemamaxskewstraw, atan2(), FindTrackInXYProjection_InputData::BETA, FindTrackInXYProjection_InputData::Charge, cos(), FindTrackInXYProjection_InputData::deltanr, FindTrackInXYProjection_InputData::dimensionscitil, Double_t, FindTrackInXYProjection_InputData::Fi_final_helix_referenceframe, FindTrackInXYProjection_InputData::Fi_initial_helix_referenceframe, FindTrackInXYProjection_InputData::Fi_low_limit, FindTrackInXYProjection_InputData::Fi_up_limit, FindTrackInXYProjection_InputData::FiConformalIndex, PndTrkLegendreFits::FitHelixCylinder(), FindTrackInXYProjection_InputData::GAMMA, FindTrackInXYProjection_InputData::HitsinBoxConf, i, FindTrackInXYProjection_InputData::icounter, FindTrackInXYProjection_InputData::iHit, FindTrackInXYProjection_InputData::InclusionListSciTil, FindTrackInXYProjection_InputData::InclusionListStt, FindTrackInXYProjection_InputData::info, FindTrackInXYProjection_InputData::infoparalConformal, FindTrackInXYProjection_InputData::ListHitsinTrack, FindTrackInXYProjection_InputData::ListSciTilHitsinTrack, FindTrackInXYProjection_InputData::ListSttParHits, m, FindTrackInXYProjection_InputData::maxhitsinfit, FindTrackInXYProjection_InputData::maxscitilhitsintrack, FindTrackInXYProjection_InputData::maxstthits, FindTrackInXYProjection_InputData::maxstthitsintrack, FindTrackInXYProjection_InputData::minimumhitspertrack, FindTrackInXYProjection_InputData::minouterhitspertrack, FindTrackInXYProjection_InputData::nBoxConf, FindTrackInXYProjection_InputData::nFicell, FindTrackInXYProjection_InputData::nfidivconformal, FindTrackInXYProjection_InputData::nHitsinTrack, NN, FindTrackInXYProjection_InputData::nRcell, FindTrackInXYProjection_InputData::nrdivconformal, FindTrackInXYProjection_InputData::nSciTilHits, FindTrackInXYProjection_InputData::nSciTilHitsinTrack, FindTrackInXYProjection_InputData::nsttparhit, offset(), FindTrackInXYProjection_InputData::Oxx, FindTrackInXYProjection_InputData::Oyy, PI, FindTrackInXYProjection_InputData::posizSciT, FindTrackInXYProjection_InputData::posizSciTilx, FindTrackInXYProjection_InputData::posizSciTily, FindTrackInXYProjection_InputData::radiaConf, FindTrackInXYProjection_InputData::RConformalIndex, FindTrackInXYProjection_InputData::Rr, FindTrackInXYProjection_InputData::rstrawdetectormax, FindTrackInXYProjection_InputData::rstrawdetectormin, FindTrackInXYProjection_InputData::S_SciTilHitsinTrack, sin(), sqrt(), status, FindTrackInXYProjection_InputData::strawradius, FindTrackInXYProjection_InputData::trajectory_vertex, FindTrackInXYProjection_InputData::TypeConf, FindTrackInXYProjection_InputData::U, FindTrackInXYProjection_InputData::V, X, Y, and FindTrackInXYProjection_InputData::YesSciTil.

175 {
176 
177  // load the struct members in local variables;
178 
179  Double_t (*info)[7]=in->info;
180  Double_t (*infoparalConformal)[5] = in->infoparalConformal ;
181 
182  // make a POINTER to an ARRAY[][3] of
183  // Double_t and assign value present in the calling sequence of this method;
184 
185  Double_t (*posizSciTil)[3]=(Double_t (*)[3])in->posizSciT;
186 
187 //---------------
188 
189  Short_t
190  i,
191  j,
192  Naux,
193  Nbaux,
194  NN,
195  Nouter,
196  auxListHitsinTrack[in->maxstthits],
197  OutputListHitsinTrack[in->maxstthits],
198  OutputList2HitsinTrack[in->maxstthits],
199  ListHitsinTrackinWhichToSearch[in->maxstthits];
200 
201  Short_t
202  flagStt,
203  status;
204 
205 
206  Double_t
207  aaa,
208  m,
209  q,
210  rotationangle,
211  rotationcos,
212  rotationsin;
213 
214 
215 
216  PndTrkCTGeometryCalculations GeomCalculator;
217 
218 
219 
220 //----------------
221  *(in->nHitsinTrack) = FindTrackPatterninBoxConformal(
222  in->FiConformalIndex,
223  in->HitsinBoxConf,
224  in->iHit, // seed hit in the PARALLEL number scheme; if it is negative it is a SciTil hit.
225  in->InclusionListStt,
226  info,
227  in->ListHitsinTrack,
228  in->ListSttParHits,
229  in->maxstthitsintrack,
230  in->maxstthits,
231  in->minimumhitspertrack,
232  in->nBoxConf,
233  in->nfidivconformal,
234  in->nFicell, // Fi cell of the seed hit;
235  2, // distance in Fi cells allowed
236  in->nsttparhit,
237  in->nRcell, // R cell of the seed hit;
238  // can be negative beacuse of SciTil hits;
239  1, // distance in R cells allowed
240  in->RConformalIndex,
241  in->nrdivconformal
242  );
243 
244  if( *(in->nHitsinTrack) < in->minimumhitspertrack ||
245  *(in->nHitsinTrack) > in->maxstthitsintrack) {
246  return false;
247  }
248 
249 //-----------------------
250 
251 // find among the ListHitsinTrack if there are at least
252 // a minimum # of hits belonging to the outer part of the STT system.
253 // At this point of the code the Stt hits are already ordered from
254 // the outermost to the innermost.
255 
256  for(j=0, Nouter =0; j<*(in->nHitsinTrack); j++){
257  if(info[ (in->ListHitsinTrack)[j] ][0]*
258  info[ (in->ListHitsinTrack)[j] ][0]+
259  info[ (in->ListHitsinTrack)[j] ][1]*
260  info[ (in->ListHitsinTrack)[j] ][1]
261  < in->apotemamaxskewstraw*in->apotemamaxskewstraw ) break;
262  Nouter++;
263  }
264 
265  if( Nouter >= in->minouterhitspertrack) {
266  for(i=0; i< Nouter;i++){
267  ListHitsinTrackinWhichToSearch[i]=
268  (in->ListHitsinTrack)[i];
269  }
270 
271  for(i=0; i< Nouter;i++){
273  in->FiConformalIndex,
274  in->HitsinBoxConf,
275  in->InclusionListStt,
276  info,
277  ListHitsinTrackinWhichToSearch[i], // seed hit.
278  ListHitsinTrackinWhichToSearch,
279  in->ListSttParHits,
280  in->maxstthits,
281  in->minimumhitspertrack,
282  in->nBoxConf,
283  1, // NFiCELLDISTANCE
284  in->nfidivconformal,
285  in->nsttparhit,
286  Nouter,
287  3, // NRCELLDISTANCE
288  in->nrdivconformal,
289  OutputListHitsinTrack,
290  in->RConformalIndex
291  );
292 
293  if( Naux >= in->minouterhitspertrack && Naux > 0.7 * Nouter ) break;
294  if( Naux >= in->minouterhitspertrack) {
295 
296 // further collection of hits in the inner region but this time strictly connected
297 // to the outer ones
298 
299 // first the list of non outer hits
300  for(j=Nouter;j<*(in->nHitsinTrack); j++){
301  ListHitsinTrackinWhichToSearch[j-Nouter] =
302  (in->ListHitsinTrack)[j];
303  }
304 
306  in->FiConformalIndex,
307  in->InclusionListStt,
308  ListHitsinTrackinWhichToSearch[i], // seed hit, in ORIGINAL numbering.
309  ListHitsinTrackinWhichToSearch, // in ORIGINAL numbering.
310  in->maxstthits,
311  1, // NFiCELLDISTANCE
312  in->nfidivconformal,
313  // n. of hits to search in ListHitsinTrackinWhichToSearch
314  *(in->nHitsinTrack)-Nouter,
315  OutputList2HitsinTrack // in ORIGINAl hit numbering.
316  );
317 // add the new hits found to the list
318 
319  *(in->nHitsinTrack)=Naux+Nbaux;
320  if( *(in->nHitsinTrack) >= in->minimumhitspertrack &&
321  *(in->nHitsinTrack) <=in->maxstthitsintrack) {
322  for(j=0;j<Naux;j++){
323  (in->ListHitsinTrack)[j] =
324  OutputListHitsinTrack[j];
325  }
326  for(j=0;j<Nbaux;j++){
327  (in->ListHitsinTrack)[Naux+j] =
328  OutputList2HitsinTrack[j];
329  }
330  break;
331 
332  }// end of if( *nHitsinTrack >= ....
333  } // end of if( Naux >= minouterhitspertrack)
334  } // end of for(i=0; i< Nouter;i++)
335  } // end of if( Nouter >= minouterhitspertrack)
336 
337  if( *(in->nHitsinTrack) < in->minimumhitspertrack ||
338  *(in->nHitsinTrack)>in->maxstthitsintrack) {
339  return false;
340  }
341 
342 //---------------------------
343 
344 // finding the rotation angle for best utilization of the MILP procedure
345 
346  for(j=0, rotationcos=0., rotationsin=0.; j<*(in->nHitsinTrack); j++){
347  rotationcos += cos((0.5+
348  (in->FiConformalIndex)[ (in->ListHitsinTrack)[j] ])
349  *2.*PI/in->nfidivconformal) ;
350 
351  rotationsin += sin((0.5+
352  in->FiConformalIndex[ (in->ListHitsinTrack)[j] ])
353  *2.*PI/in->nfidivconformal) ;
354  }
355  rotationcos /=*(in->nHitsinTrack);
356  rotationsin /=*(in->nHitsinTrack);
357  rotationangle = atan2(rotationsin, rotationcos);
358 // fitting with superfast MILP code
359  //bool Type; //[R.K. 01/2017] unused variable?
360 
361  int nFitPoints,
362  offset;
363  Double_t
364  Xconformal[1+(*(in->nHitsinTrack))],
365  Yconformal[1+(*(in->nHitsinTrack))],
366  DriftRadiusconformal[1+(*(in->nHitsinTrack))],
367  ErrorDriftRadiusconformal[1+(*(in->nHitsinTrack))];
368 
369 
370  if(in->iHit<0){ // case with a hit in the SciTil
371  aaa = in->posizSciTilx*in->posizSciTilx+in->posizSciTily*in->posizSciTily;
372  Xconformal[0] =in->posizSciTilx/aaa;
373  Yconformal[0] =in->posizSciTily/aaa;
374  ErrorDriftRadiusconformal[0] = in->dimensionscitil/aaa;
375  DriftRadiusconformal[0]=-1.; // treat it like it is a Mvd hit.
376  // +1 comes from one SciTil hit.
377  offset=1;
378  nFitPoints = *(in->nHitsinTrack) + 1;
379 
380  } else { // no SciTil hit.
381  offset=0;
382  nFitPoints = *(in->nHitsinTrack);
383  } // end of if(in->iHit<0)
384 
385 
386 
387  for(j=0; j<(*(in->nHitsinTrack)); j++){
388  Xconformal[j+offset] =infoparalConformal[(in->ListHitsinTrack)[j]][0];
389  Yconformal[j+offset] =infoparalConformal[(in->ListHitsinTrack)[j]][1];
390  ErrorDriftRadiusconformal[j+offset]=
391  infoparalConformal[(in->ListHitsinTrack)[j]][2];
392  DriftRadiusconformal[j+offset]=
393  infoparalConformal[(in->ListHitsinTrack)[j]][2];
394  }
395 
396 
397 // PndTrkGlpkFits fit;
398 
399  PndTrkLegendreFits fit;
400 
401  status = fit.FitHelixCylinder(
402  nFitPoints, // +1 comes from one SciTil hit.
403  Xconformal,
404  Yconformal,
405  DriftRadiusconformal,
406  ErrorDriftRadiusconformal,
407  rotationangle, // rotationangle, da mettere
408  in->trajectory_vertex, // vertex in (X,Y) of this trajectory
409  in->maxhitsinfit, // maximum n. of hits allowed in fast fit
410  &m,
411  &q,
412  in->ALFA,
413  in->BETA,
414  in->GAMMA,
415  in->TypeConf,
416  0, // istampa
417  in->icounter // IVOLTE
418  );
419 
420 
421  if(status < 0 ) return false;
422 
423 // this trasformation is valid even if the equation is a straight line from the fit
424 
425  *(in->Oxx)= -0.5*(*(in->ALFA));
426  *(in->Oyy)= -0.5*(*(in->BETA));
427  *(in->Rr)= (*(in->Oxx)) * (*(in->Oxx)) + (*(in->Oyy)) * (*(in->Oyy))-(*(in->GAMMA));
428 
429  // some obvious preliminary cuts
430  if( *(in->Rr) < 0. ) return false;
431  *(in->Rr)= sqrt( *(in->Rr) );
432  aaa = sqrt( (*(in->Oxx)) * (*(in->Oxx)) + (*(in->Oyy)) * (*(in->Oyy)) );
433 
434  // the following is because the circumference is supposed to come from (0,0);
435  // here the factor 0.9 is used in order to be conservative.
436  if(aaa< 0.9*in->rstrawdetectormin/2.) return false;
437 
438 // here the factor 0.9 is used in order to be conservative.
439  if ( *(in->Rr) + aaa < in->rstrawdetectormin *0.9 ) return false;
440 
441 //---------------------------
442 
443 // check again if the SciTil hit (if present) is compatible with this circle trajectory
444 // in XY by finding if it has intersection (in the XY plane) with Helix circle
445 
446 // equation of the SciTil segment : y0 * y + x0 * x - x0**2 - y0**2 = 0
447 // where (x0,y0) = position of center of the SciTil.
448 
449 // delimiting points of the SciTil segment : define L = length of the SciTil,
450 // and RR = sqrt(x0**2+y0**2), SIGN = the sign of (-x0*y0) or SIGN=1 when y0=0,
451 // SIGN=irrelevant when x0=0; then :
452 // P1 = [ x0- abs{(L/2)*y0/RR}; y0-SIGN*abs{(L/2)*x0/RR} ],
453 // P2 = [ x0+abs{(L/2)*y0/RR}; y0+SIGN*abs{(L/2)*x0/RR} ].
454 
455  //bool intersect; //[R.K. 01/2017] unused variable?
456  //Short_t
457  //Nint; //[R.K. 01/2017] unused variable?
458 // nSciT;
459  //Double_t distance, //[R.K. 01/2017] unused variable?
460  //QQ, //[R.K. 01/2017] unused variable?
461  //sqrtRR, //[R.K. 01/2017] unused variable?
462  //SIGN, //[R.K. 01/2017] unused variable?
463  //XintersectionList[2], //[R.K. 01/2017] unused variable?
464  //YintersectionList[2]; //[R.K. 01/2017] unused variable?
465 
466 
467  // whether or not the seed hit was a Stt hit try if any SciTil hits are
468  // associated to this track cand.
469 
470 
471  if(in->YesSciTil){
472  // *(in->nSciTilHitsinTrack) is the n. of SciTil hit associated to this track.
473  *(in->nSciTilHitsinTrack)= AssociateSciTilHit(
474  in->dimensionscitil,
475  in->S_SciTilHitsinTrack,// output; S on the lateral face of the Helix
476  // of the SciTil hit (if present).
477  in->InclusionListSciTil,
478  in->ListSciTilHitsinTrack,
479  in->maxscitilhitsintrack,
480  in->nSciTilHits,
481  *(in->Oxx),
482  *(in->Oyy),
483  posizSciTil,
484  *(in->Rr)
485  );
486 
487  // even though it should be impossible in principle, EXCLUDE the possibility of having more
488  // than TWO SciTil hits belonging to a track;
489 
490  if( *(in->nSciTilHitsinTrack) >0 ){
491  // even though it should be impossible in principle, EXCLUDE
492  // the possibility of having more
493  // than TWO SciTil hits belonging to a track;
494  if( *(in->nSciTilHitsinTrack) > 2 ) *(in->nSciTilHitsinTrack)=2;
495 
496  for(j=0;j<*(in->nSciTilHitsinTrack);j++){
497  (in->InclusionListSciTil)[(in->ListSciTilHitsinTrack)[j]]
498  =false;
499  }
500  }
501 
502  }else{
503  *(in->nSciTilHitsinTrack)=0;
504  } // end of if(YesSciTil)
505 
506 
507 //--------------------- better association of the hits in the track candidate
508 // treat differently the case in which the track has radius < rstrawdetectormax/2
509 // and the other case.
510 
511  if( *(in->Rr) < in->rstrawdetectormax/2){
512  GeomCalculator.FindingParallelTrackAngularRange(
513  *(in->Oxx),
514  *(in->Oyy),
515  *(in->Rr),
516  1, // this is supposed to be the charge, irrelevant here if it is +1 or -1.
517  in->Fi_low_limit,
518  in->Fi_up_limit,
519  &flagStt,
520  in->rstrawdetectormin,
521  in->rstrawdetectormax
522  );
523 
525  auxListHitsinTrack, // this is the output
526  in->InclusionListStt,
527  *(in->Fi_low_limit),
528  *(in->Fi_up_limit),
529  info,
530  in->ListSttParHits,
531  in->nsttparhit,
532  *(in->Oxx),
533  *(in->Oyy),
534  *(in->Rr),
535  in->strawradius
536  );
537 
538 
539  } else {
540 
542  auxListHitsinTrack, // this is the output
543  in->deltanr,
544  in->FiConformalIndex,
545  in->HitsinBoxConf,
546  in->InclusionListStt,
547  info,
548  infoparalConformal,
549  in->ListHitsinTrack,
550  m,
551  in->maxstthits,
552  in->nBoxConf,
553  in->nfidivconformal,
554  *(in->nHitsinTrack),
555  in->nsttparhit,
556  in->nrdivconformal,
557  *(in->Oxx),
558  *(in->Oyy),
559  q,
560  in->radiaConf,
561  in->RConformalIndex,
562  *(in->Rr),
563  in->rstrawdetectormin,
564  status,
565  in->strawradius
566  );
567 
568  } // end of if( Rr < rstrawdetectormax/2)
569 
570  if( NN < in->minimumhitspertrack || NN>in->maxstthitsintrack) return false;
571 
572  *(in->nHitsinTrack)=NN;
573 
574  for(i=0; i< *(in->nHitsinTrack);i++){
575  (in->ListHitsinTrack)[i]=auxListHitsinTrack[i];
576  }
577 
578 
579 
580 //----------------------------- Finding the Charge
581  // The charge is calculated first by dividing the hits in two categories by using the Perpendicular
582  // to the tangent to the trajectory in (0,0). Then simply the majority of the hits decides the
583  // sign of the charge. See Gianluigi's Logbook page 290.
584 
585  Double_t
586  X[*(in->nHitsinTrack)],
587  Y[*(in->nHitsinTrack)];
588 
589  for(i=0;i<*(in->nHitsinTrack);i++){
590  X[i]=info[(in->ListHitsinTrack)[i]][0];
591  Y[i]=info[(in->ListHitsinTrack)[i]][1];
592  }
593  FindCharge(
594  *(in->Oxx),
595  *(in->Oyy),
596  *(in->nHitsinTrack),
597  X,
598  Y,
599  in->Charge
600  );
601 
602 
603 //----------------------------- Ordering.
604  // The ordering reflects the angle Fi in the Helix reference frame because
605  // the hits are ordered by going around the trajectory cclockwise for
606  // positive tracks or counterclockwise for negative particles; in other words
607  // it is not used simply the distance of the hit from (0,0) as ordering parameter
608  // but the track length of the circle.
609  // this method finds also Fi_initial_helix_referenceframe and Fi_final_helix_referenceframe.
610  // The former is simply the fi angle of the point (0,0) with respect to the center
611  // of this Helix. Important : this angle has to be > 0 always and it is between 0. and
612  // 2 PI here (later, FixDiscontinuitiesFiangleinSZplane may change it adding +2PI or
613  // -2PI if necessary).
614  // Fi_final_helix_referenceframe is made such that it is < Fi_initial_helix_referenceframe
615  // when the track is positive, and it is > Fi_initial_helix_referenceframe for negative
616  // tracks.
617 
619  *(in->Charge),
620  in->Fi_initial_helix_referenceframe,//output
621  in->Fi_final_helix_referenceframe,// output
622  info,
623  in->ListHitsinTrack,
624  *(in->nHitsinTrack),
625  *(in->Oxx),
626  *(in->Oyy),
627  in->U,
628  in->V
629  );
630 
631 // finding the FI angular range (in the laboratory frame) spanned by this parallel track
632 
633  GeomCalculator.FindingParallelTrackAngularRange(
634  *(in->Oxx),
635  *(in->Oyy),
636  *(in->Rr),
637  *(in->Charge),
638  in->Fi_low_limit,
639  in->Fi_up_limit,
640  &flagStt,
641  in->rstrawdetectormin,
642  in->rstrawdetectormax
643  );
644 
645 
646  if( flagStt == -2 ) return false; // track outside cylinder rstrawdetectormax.
647  if( flagStt == -1 ) return false; // track inside cylinder rstrawdetectormin.
648  if( flagStt == 1 ) return false; // track comprised in cylinder : discard,
649  // because at this stage only tracks from
650  // vertex are searched.
651 
652 
653 
654 
655  return true;
656 };
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
Short_t FitHelixCylinder(Short_t nHitsinTrack, Double_t *Xconformal, Double_t *Yconformal, Double_t *DriftRadiusconformal, Double_t *ErrorDriftRadiusconformal, Double_t rotationangle, Double_t trajectory_vertex[2], Short_t NMAX, Double_t *m, Double_t *q, Double_t *pAlfa, Double_t *pBeta, Double_t *pGamma, bool *Type, int istampa, int IVOLTE)
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Short_t FindTrackStrictCollection(Short_t *FiConformalIndex, bool *InclusionListStt, Short_t iSeed, Short_t *ListHitsinTrackinWhichToSearch, Short_t MAXSTTHITS, Short_t NFiCELLDISTANCE, Short_t nfidivconformal, Short_t NParallelToSearch, Short_t *OutputListHitsinTrack)
void OrderingParallel(Short_t Charge, Double_t *Fi_initial_helix_referenceframe, Double_t *Fi_final_helix_referenceframe, Double_t info[][7], Short_t *ListParallelHits, Short_t nParallelHits, Double_t oX, Double_t oY, Double_t *U, Double_t *V)
TVector3 offset(2, 0, 0)
Short_t TrkAssociatedParallelHitsToHelixQuater(Short_t *auxListHitsinTrack, Double_t deltanr, Short_t *FiConformalIndex, Short_t *HitsinBoxConformal, bool *InclusionListStt, Double_t info[][7], Double_t infoparalConformal[][5], Short_t *ListHitsinTrack, Double_t m, Short_t MAXSTTHITS, Short_t *nBoxConformal, Short_t nfidivconformal, Short_t nHitsinTrack, Int_t NhitsParallel, Short_t nrdivconformal, Double_t Oxx, Double_t Oyy, Double_t q, Double_t *radiaConf, Short_t *RConformalIndex, Double_t Rr, Double_t rstrawdetectormin, Short_t Status, Double_t strawradius)
double Y
Definition: anaLmdDigi.C:68
Short_t TrkAssociatedParallelHitsToHelix5(Short_t *auxListHitsinTrack, bool *InclusionListStt, Double_t Fi_low, Double_t Fi_up, Double_t info[][7], Short_t *ListSttParHits, Int_t NhitsParallel, Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t strawradius)
Double_t
Short_t FindTrackPatterninBoxConformalSpecial(Short_t *FiConformalIndex, Short_t *HitsinBoxConformal, bool *InclusionListStt, Double_t info[][7], Short_t iSeed, Short_t *ListHitsinTrackinWhichToSearch, Short_t *ListSttParHits, Short_t maxstthits, Short_t minimumhitspertrack, Short_t *nBoxConformal, Short_t NFiCELLDISTANCE, Short_t nfidivconformal, Short_t Nparal, Short_t NparallelToSearch, Short_t NRCELLDISTANCE, Short_t nrdivconformal, Short_t *OutputListHitsinTrack, Short_t *RConformalIndex)
Short_t FindTrackPatterninBoxConformal(Short_t *FiConformalIndex, Short_t *HitsinBoxConformal, Short_t ihit, bool *InclusionListStt, Double_t info[][7], Short_t *ListHitsinTrack, Short_t *ListSttParHits, Short_t maxstthitsintracks, Short_t maxstthits, Short_t minimumhitspertrack, Short_t *nBoxConformal, Short_t nfidivconformal, Short_t nFicell, Short_t NFiCELLDISTANCE, Short_t Nparal, Short_t nRcell, Short_t NRCELLDISTANCE, Short_t *RConformalIndex, Short_t nrdivconformal)
Short_t AssociateSciTilHit(Double_t dimensionscitil, Double_t *esse, bool *InclusionListSciTil, Short_t *List, Short_t maxscitilhitsintrack, Short_t nSciTilHits, Double_t Oxx, Double_t Oyy, Double_t posizSciTil[][3], Double_t Rr)
#define PI
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
double X
Definition: anaLmdDigi.C:68
int status[10]
Definition: f_Init.h:28
void FindCharge(Double_t oX, Double_t oY, Short_t nHits, Double_t *X, Double_t *Y, Short_t *Charge)
Short_t PndTrkCTFindTrackInXY::FindTrackPatterninBoxConformal ( Short_t *  FiConformalIndex,
Short_t *  HitsinBoxConformal,
Short_t  ihit,
bool *  InclusionListStt,
Double_t  info[][7],
Short_t *  ListHitsinTrack,
Short_t *  ListSttParHits,
Short_t  maxstthitsintracks,
Short_t  maxstthits,
Short_t  minimumhitspertrack,
Short_t *  nBoxConformal,
Short_t  nfidivconformal,
Short_t  nFicell,
Short_t  NFiCELLDISTANCE,
Short_t  Nparal,
Short_t  nRcell,
Short_t  NRCELLDISTANCE,
Short_t *  RConformalIndex,
Short_t  nrdivconformal 
)

Definition at line 664 of file PndTrkCTFindTrackInXY.cxx.

References i, and status.

686 {
687 
688  bool
689  status,
690  TemporaryInclusionList[maxstthits];
691 
692  Short_t
693  bi_index,
694  i,
695  j,
696  iFi,
697  iR,
698  nRmin,
699  nRmax,
700  nRemainingHits,
701  nHitsinTrack,
702  tri_index;
703  //auxIndex[maxstthits], //[R.K. 01/2017] unused variable?
704  //Remaining[maxstthits]; //[R.K. 01/2017] unused variable?
705 
706  Short_t iFi2;
707 
708  //Double_t auxRvalues[maxstthits]; //[R.K. 01/2017] unused variable?
709 
710 
711 // ihit is the hit number in the PARALLEL number scheme
712 
713  for(i=0, nRemainingHits=0; i<Nparal; i++){
714 
715  if( i != ihit && InclusionListStt[ ListSttParHits[i] ] ) { // Inclusion of the
716  // parallel hit straws already used in other tracks
717  // remember the index of InclusionListStt is in the
718  // ORIGINAL scheme of hits
719  TemporaryInclusionList[ ListSttParHits[i] ]= true;
720  //Remaining[nRemainingHits]= i; // index of the PARALLEL hit //[R.K. 01/2017] unused variable?
721  nRemainingHits++;
722  } else {
723  TemporaryInclusionList[ ListSttParHits[i] ]= false;
724  }
725  }
726 
727  if( nRemainingHits < minimumhitspertrack ) return 0;
728 
729 
730 // cells of the seed hit
731 
732  if(ihit>=0){
733  nHitsinTrack=1;
734  ListHitsinTrack[0]= ListSttParHits[ihit] ;
735  i = 0;
736  } else {
737  nHitsinTrack=0;
738  i = -1;
739  }
740 
741  status=true;
742 
743 
744  while( nRemainingHits > 0 && i < nHitsinTrack && status) {
745 
746 
747  if (nRcell - NRCELLDISTANCE < 0 ) {
748  nRmin = 0;
749  } else {
750  nRmin = nRcell - NRCELLDISTANCE;
751  }
752  if (nRcell + NRCELLDISTANCE >= nrd ) {
753  nRmax = nrd-1;
754  } else {
755  nRmax = nRcell + NRCELLDISTANCE;
756  }
757 
758 
759 
760  for( iR= nRmin ; iR<= nRmax && status ; iR++){
761  for(iFi2=nFicell-NFiCELLDISTANCE;iFi2<=nFicell+NFiCELLDISTANCE && status;iFi2++){
762  if ( iFi2 < 0 ) {
763  iFi = nfid + iFi2;
764  } else if ( iFi2 >= nfid) {
765  iFi = iFi2 - nfid;
766  } else {
767  iFi = iFi2;
768  }
769  bi_index = iR*nfid+iFi;
770  for (j = 0; j< nBoxConformal[bi_index]; j++){
771  tri_index = j*nrd*nfid+bi_index;
772  if( InclusionListStt[ HitsinBoxConformal[tri_index] ]
773  &&
774  TemporaryInclusionList[HitsinBoxConformal[tri_index]]) {
775  // hit number in the ORIGINAL straws scheme
776  ListHitsinTrack[nHitsinTrack]=HitsinBoxConformal[tri_index] ;
777  nHitsinTrack++;
778  if( nHitsinTrack >= maxstthitsintrack){
779  // finish the search
780  status=false; // finish all outer loops as well.
781  break ;
782  }
783  TemporaryInclusionList[HitsinBoxConformal[tri_index]]= false;
784  nRemainingHits--;
785  } // end of if( InclusionListStt[ ListSttParHits[...]]
786  }// end of for (j = 0; j< ....
787  } // end of for( iFi2 = nFicell - NFiCELLDISTANCE ;
788  } // end of for( iR= nRmin ; iR<= nRmax ; iR++)
789 //----------------
790  i++;
791  if(i<maxstthitsintrack){
792  nRcell = RConformalIndex[ListHitsinTrack[i]];
793  nFicell = FiConformalIndex[ListHitsinTrack[i]];
794  }
795  } // end while ( nRemainingHits > 0 && i < nHitsinTrack)
796 
797 
798 
799  return nHitsinTrack;
800 
801 }
Int_t i
Definition: run_full.C:25
int status[10]
Definition: f_Init.h:28
Short_t PndTrkCTFindTrackInXY::FindTrackPatterninBoxConformalSpecial ( Short_t *  FiConformalIndex,
Short_t *  HitsinBoxConformal,
bool *  InclusionListStt,
Double_t  info[][7],
Short_t  iSeed,
Short_t *  ListHitsinTrackinWhichToSearch,
Short_t *  ListSttParHits,
Short_t  maxstthits,
Short_t  minimumhitspertrack,
Short_t *  nBoxConformal,
Short_t  NFiCELLDISTANCE,
Short_t  nfidivconformal,
Short_t  Nparal,
Short_t  NparallelToSearch,
Short_t  NRCELLDISTANCE,
Short_t  nrdivconformal,
Short_t *  OutputListHitsinTrack,
Short_t *  RConformalIndex 
)

Definition at line 814 of file PndTrkCTFindTrackInXY.cxx.

References i.

834 {
835 
836 
837  bool TemporaryInclusionList[maxstthits];
838 
839  Short_t
840  bi_index,
841  i,
842  i2,
843  j,
844  iFi,
845  iFi2,
846  iR,
847  nFicell,
848  nHitsinTrack,
849  nRcell,
850  nRemainingHits,
851  nRmax,
852  nRmin,
853  tri_index;
854  //auxIndex[maxstthits], //[R.K. 01/2017] unused variable?
855  //Remaining[maxstthits]; //[R.K. 01/2017] unused variable?
856 
857 
858  //Double_t auxRvalues[maxstthits]; //[R.K. 01/2017] unused variable?
859 
860 
861 
862 
863 // iSeed is the hit number in the ORIGINAL number scheme
864 
865 //-------- the following initialization is essential for the algorithm to work
866  for(i=0; i<Nparal; i++){
867  TemporaryInclusionList[ ListSttParHits[i] ]= false;
868  }
869 //-------------
870 
871  for(i2=0, nRemainingHits=0; i2<NparallelToSearch; i2++){
872  i=ListHitsinTrackinWhichToSearch[i2];
873 // Inclusion of the parallel hit straws already used in other tracks;
874 // remember the index of InclusionListStt is in the ORIGINAL scheme of hits.
875  if( i != iSeed && InclusionListStt[ListSttParHits[i]] ) {
876  TemporaryInclusionList[ListSttParHits[i]]= true;
877  //Remaining[nRemainingHits]= i; // index of the PARALLEL hit //[R.K. 01/2017] unused variable?
878  nRemainingHits++;
879  }
880  }
881 
882 
883  if( nRemainingHits < minimumhitspertrack ) return 0;
884 
885 // cells of the seed hit
886 
887  nHitsinTrack=1;
888  OutputListHitsinTrack[0]= iSeed ;
889  i = 0;
890  while( nRemainingHits > 0 && i < nHitsinTrack) {
891 
892  nRcell = RConformalIndex[OutputListHitsinTrack[i]];
893  nFicell = FiConformalIndex[OutputListHitsinTrack[i]];
894 
895 //---------------
896 
897  if (nRcell - NRCELLDISTANCE < 0 ) {
898  nRmin = 0;
899  } else {
900  nRmin = nRcell - NRCELLDISTANCE;
901  }
902  if (nRcell + NRCELLDISTANCE >= nrd ) {
903  nRmax = nrd-1;
904  } else {
905  nRmax = nRcell + NRCELLDISTANCE;
906  }
907 
908  for( iR= nRmin ; iR<= nRmax ; iR++){
909  for( iFi2=nFicell-NFiCELLDISTANCE ;
910  iFi2<=nFicell+NFiCELLDISTANCE;iFi2++){
911  if ( iFi2 < 0 ) {
912  iFi = nfid + iFi2;
913  } else if ( iFi2 >= nfid) {
914  iFi = iFi2 - nfid;
915  } else {
916  iFi = iFi2;
917  }
918  bi_index = iR*nfid+iFi;
919  for (j = 0; j< nBoxConformal[bi_index]; j++){
920  tri_index = j*nrd*nfid+bi_index;
921 
922  if(InclusionListStt[HitsinBoxConformal[tri_index]]
923  &&
924  TemporaryInclusionList[ HitsinBoxConformal[tri_index]]
925  ) {
926 // hit number in the ORIGINAL straws scheme
927  OutputListHitsinTrack[nHitsinTrack]=HitsinBoxConformal[tri_index] ;
928  nHitsinTrack++;
929  TemporaryInclusionList[HitsinBoxConformal[tri_index]]
930  = false;
931  nRemainingHits--;
932  } // end of if(InclusionListStt[ .. ]
933  } // end of for (j = 0; j< *(nBoxConfor ....
934  } // end of for( iFi2=nFice
935  } // end of for( iR= nRmin
936 //----------------
937  i++;
938 
939  } // end while ( nRemainingHits > 0 && i < nHitsinTrack)
940 
941 
942  return nHitsinTrack;
943 
944 }
Int_t i
Definition: run_full.C:25
Short_t PndTrkCTFindTrackInXY::FindTrackStrictCollection ( Short_t *  FiConformalIndex,
bool *  InclusionListStt,
Short_t  iSeed,
Short_t *  ListHitsinTrackinWhichToSearch,
Short_t  MAXSTTHITS,
Short_t  NFiCELLDISTANCE,
Short_t  nfidivconformal,
Short_t  NParallelToSearch,
Short_t *  OutputListHitsinTrack 
)

Definition at line 952 of file PndTrkCTFindTrackInXY.cxx.

References i.

965 {
966 
967  Short_t
968  i,
969  iFi,
970  iFiseed,
971  //iR, //[R.K. 01/2017] unused variable?
972  //j, //[R.K. 01/2017] unused variable?
973  nHitsinTrack;
974 
975 
976  //Double_t auxRvalues[maxstthits]; //[R.K. 01/2017] unused variable?
977 
978 // iSeed is the hit number in the ORIGINAL number scheme
979 
980  iFiseed = FiConformalIndex[iSeed];
981 
982  nHitsinTrack=0;
983  for(i=0; i<NParallelToSearch; i++){
984  // Inclusion of the parallel hit straws already used in other tracks
985  if( InclusionListStt[ListHitsinTrackinWhichToSearch[i]]) {
986  // the index of InclusionListStt is in the ORIGINAL scheme of hits
987 
988  iFi = FiConformalIndex[ListHitsinTrackinWhichToSearch[i]];
989  if( iFi == iFiseed ) {
990  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
991  nHitsinTrack++;
992  } else if ( iFi < iFiseed ) {
993  if(iFiseed - iFi <= NFiCELLDISTANCE ){
994  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
995  nHitsinTrack++;
996  } else {
997  if(iFi+nfid-iFiseed<=NFiCELLDISTANCE) {
998  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
999  nHitsinTrack++;
1000  }
1001  } // end of if(iFiseed - iFi <= NFiCELLDISTANCE)
1002  }else{ // continuation of if( iFi == iFiseed )
1003  if( -iFiseed + iFi <= NFiCELLDISTANCE ) {
1004  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
1005  nHitsinTrack++;
1006  }else{
1007  if( -iFi + nfid + iFiseed<= NFiCELLDISTANCE ) {
1008  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
1009  nHitsinTrack++;
1010  }
1011  } // end of if( -iFiseed + iFi <= NFiCELLDISTANCE )
1012 
1013  } // end of if( iFi == iFiseed )
1014 
1015  } // end of if( InclusionListStt[ListHitsinTrackinWhichToSearch[i]])
1016 
1017  } // end of for(i=0; i<NparallelToSearch; i++)
1018 
1019 
1020 
1021  return nHitsinTrack;
1022 
1023 }
Int_t i
Definition: run_full.C:25
void PndTrkCTFindTrackInXY::OrderingParallel ( Short_t  Charge,
Double_t Fi_initial_helix_referenceframe,
Double_t Fi_final_helix_referenceframe,
Double_t  info[][7],
Short_t *  ListParallelHits,
Short_t  nParallelHits,
Double_t  oX,
Double_t  oY,
Double_t U,
Double_t V 
)

Definition at line 1030 of file PndTrkCTFindTrackInXY.cxx.

References atan2(), b1, Double_t, i, PndTrkMergeSort::Merge_Sort(), and PI.

1042 {
1043 
1044  Short_t
1045  i,
1046  j,
1047  tmp[nParallelHits];
1048 
1049  Int_t tempo[nParallelHits];
1050 
1051  Double_t aaa,
1052  b1,
1053  //firstR2, //[R.K. 01/2017] unused variable?
1054  //lastR2, //[R.K. 01/2017] unused variable?
1055  aux[nParallelHits];
1056 
1057  PndTrkMergeSort MergeSort;
1058 
1059 
1060 
1061 // here there is the ordering of the hits, under the assumption that the circumference
1062 // in XY goes through (0,0).
1063 // Moreover, the code before is supposed to have selected trajectories in XY with (Ox,Oy)
1064 // farther from (0,0) by > 0.9 * RminStrawDetector/2 and consequently Ox and Oy are not both 0.
1065 // The scheme for the ordering of the hit is as follows :
1066 // 1) order hits by increasing U or V of the conformal mapping; see Gianluigi's Logbook page 283;
1067 // 2) find the charge of the track by checking if it is closest to the center in XY
1068 // the first or the last of the ordered hits.
1069 // 3) in case, invert the ordering of U, V and ListParallelHits such that the first hits in the
1070 // list are alway those closer to the (0,0).
1071 
1072 
1073 // ordering of the hits
1074 
1075  aaa = atan2( oY, oX); // atan2 defined between -PI and PI.
1076 
1077  // the following statement is necessary since for unknown reason the root interpreter
1078  // gives a weird error when using PI directly in the if statement below!!!!!!! I lost
1079  // 2 hours trying to figure this out!
1080  b1 = PI/4.;
1081 
1082  if((b1<aaa && aaa<3.*b1) || (aaa>-3.*b1&&aaa<-b1)){//use U as ordering variable;
1083  //[case 1 or 3 Gianluigi's Logbook page 285].
1084  for (j = 0; j< nParallelHits; j++){
1085  U[j]=info[ ListParallelHits[j] ][0]/(
1086  info[ ListParallelHits[j] ][0]*
1087  info[ ListParallelHits[j] ][0]+
1088  info[ ListParallelHits[j] ][1]*
1089  info[ ListParallelHits[j] ][1]);
1090  }
1091  for (j = 0; j< nParallelHits; j++){
1092  tempo[j]= (Int_t) ListParallelHits[j];
1093  }
1094  MergeSort.Merge_Sort( nParallelHits, U, tempo);
1095  for (j = 0; j< nParallelHits; j++){
1096  ListParallelHits[j] = (Short_t) tempo[j];
1097  }
1098 
1099  if((aaa>b1&&aaa<3.*b1)){ // case #1;
1100  if( Charge == -1){
1101  // inverting the order of the hits.
1102  for(i=0;i<nParallelHits;i++){
1103  tmp[i]=ListParallelHits[nParallelHits-1-i];
1104  aux[i] = U[nParallelHits-1-i];
1105  }
1106  for(i=0;i<nParallelHits;i++){
1107  ListParallelHits[i]=tmp[i];
1108  U[i] = aux[i];
1109  }
1110  }
1111  for (j = 0; j< nParallelHits; j++){
1112  V[j]=info[ ListParallelHits[j] ][1]/(
1113  info[ ListParallelHits[j] ][0]*
1114  info[ ListParallelHits[j] ][0]+
1115  info[ ListParallelHits[j] ][1]*
1116  info[ ListParallelHits[j] ][1]);
1117  }
1118  } else{ // case # 3.
1119  if(Charge == 1){
1120  // inverting the order of the hits.
1121  for(i=0;i<nParallelHits;i++){
1122  tmp[i]=ListParallelHits[nParallelHits-1-i];
1123  aux[i] = U[nParallelHits-1-i];
1124  }
1125  for(i=0;i<nParallelHits;i++){
1126  ListParallelHits[i]=tmp[i];
1127  U[i] = aux[i];
1128  }
1129  }// end of if( Charge ==1)
1130  for (j = 0; j< nParallelHits; j++){
1131  V[j]=info[ ListParallelHits[j] ][1]/(
1132  info[ ListParallelHits[j] ][0]*
1133  info[ ListParallelHits[j] ][0]+
1134  info[ ListParallelHits[j] ][1]*
1135  info[ ListParallelHits[j] ][1]);
1136  }
1137  }// end of if((aaa>b1&&aaa<3.*b1))
1138 
1139  } else { // use V as ordering variable [case 2 or 4 Gianluigi's Logbook page 285].
1140  for (j = 0; j< nParallelHits; j++){
1141  V[j]=info[ ListParallelHits[j] ][1]/(
1142  info[ ListParallelHits[j] ][0]*
1143  info[ ListParallelHits[j] ][0]+
1144  info[ ListParallelHits[j] ][1]*
1145  info[ ListParallelHits[j] ][1]);
1146  }
1147  for (j = 0; j< nParallelHits; j++){
1148  tempo[j]= (Int_t) ListParallelHits[j];
1149  }
1150  MergeSort.Merge_Sort( nParallelHits, V, tempo);
1151  for (j = 0; j< nParallelHits; j++){
1152  ListParallelHits[j] = (Short_t) tempo[j];
1153  }
1154 
1155  if((aaa<=-3.*b1 || aaa>=3.*b1)){ // case #2;
1156  if( Charge == -1){
1157  // inverting the order of the hits.
1158  for(i=0;i<nParallelHits;i++){
1159  tmp[i]=ListParallelHits[nParallelHits-1-i];
1160  aux[i] = V[nParallelHits-1-i];
1161  }
1162  for(i=0;i<nParallelHits;i++){
1163  ListParallelHits[i]=tmp[i];
1164  V[i] = aux[i];
1165  }
1166  }
1167  for (j = 0; j< nParallelHits; j++){
1168  U[j]=info[ ListParallelHits[j] ][0]/(
1169  info[ ListParallelHits[j] ][0]*
1170  info[ ListParallelHits[j] ][0]+
1171  info[ ListParallelHits[j] ][1]*
1172  info[ ListParallelHits[j] ][1]);
1173  }
1174  } else{ // case # 4.
1175  if( Charge == 1){
1176  // inverting the order of the hits.
1177  for(i=0;i<nParallelHits;i++){
1178  tmp[i]=ListParallelHits[nParallelHits-1-i];
1179  aux[i] = V[nParallelHits-1-i];
1180  }
1181  for(i=0;i<nParallelHits;i++){
1182  ListParallelHits[i]=tmp[i];
1183  V[i] = aux[i];
1184  }
1185  }
1186  for (j = 0; j< nParallelHits; j++){
1187  U[j]=info[ ListParallelHits[j] ][0]/(
1188  info[ ListParallelHits[j] ][0]*
1189  info[ ListParallelHits[j] ][0]+
1190  info[ ListParallelHits[j] ][1]*
1191  info[ ListParallelHits[j] ][1]);
1192  }
1193  }
1194 
1195  } // end of if((aaa>b1&& ....
1196 
1197 
1198 
1199 
1200 
1201 
1202 // FI initial value (at 0,0 vertex) in the Helix reference frame
1203 
1204  *Fi_initial_helix_referenceframe = atan2(-oY,-oX) ;// this is in order to be coherent
1205  // with the calculatation of Fi, which is atan2(oY,oX).
1206  // atan2 is defined in [-PI,PI)
1207  if ( *Fi_initial_helix_referenceframe <0.)
1208  *Fi_initial_helix_referenceframe += 2.*PI;
1209 
1210 // FI of the last parallel hit in the Helix reference frame
1211 
1212  *Fi_final_helix_referenceframe = atan2(
1213  info[ ListParallelHits[nParallelHits-1] ][1]-oY,
1214  info[ ListParallelHits[nParallelHits-1] ][0]-oX
1215  );
1216  if ( *Fi_final_helix_referenceframe <0.)
1217  *Fi_final_helix_referenceframe += 2.*PI;
1218 
1219  if ( Charge > 0 ) {
1220  if( *Fi_final_helix_referenceframe> *Fi_initial_helix_referenceframe)
1221  *Fi_final_helix_referenceframe -= 2.*PI;
1222  if( *Fi_final_helix_referenceframe> *Fi_initial_helix_referenceframe)
1223  *Fi_final_helix_referenceframe = *Fi_initial_helix_referenceframe;
1224  } else {
1225  if( *Fi_final_helix_referenceframe< *Fi_initial_helix_referenceframe)
1226  *Fi_final_helix_referenceframe += 2.*PI;
1227  if( *Fi_final_helix_referenceframe< *Fi_initial_helix_referenceframe)
1228  *Fi_final_helix_referenceframe = *Fi_initial_helix_referenceframe;
1229  }
1230 
1231 
1232 
1233 
1234  return;
1235 
1236 
1237 }
Int_t i
Definition: run_full.C:25
Double_t
#define PI
void Merge_Sort(Short_t n_ele, Double_t *array, Int_t *ind)
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Short_t PndTrkCTFindTrackInXY::TrkAssociatedParallelHitsToHelix5 ( Short_t *  auxListHitsinTrack,
bool *  InclusionListStt,
Double_t  Fi_low,
Double_t  Fi_up,
Double_t  info[][7],
Short_t *  ListSttParHits,
Int_t  NhitsParallel,
Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Double_t  strawradius 
)

Definition at line 1730 of file PndTrkCTFindTrackInXY.cxx.

References angle, atan2(), Double_t, dx, dy, fabs(), i, PI, and sqrt().

1743 {
1744 
1745  Short_t i;
1746 
1747  Short_t nAssociatedHits;
1748 
1749  Double_t angle,
1750  dx,
1751  dy,
1752  distance,
1753  NTIMES=5.; // number of Straw radia allowed in association.
1754 
1755  nAssociatedHits=0;
1756 // find the Hits belonging to this Track.
1757 
1758 
1759 
1760  for(i=0; i<NhitsParallel;i++){
1761  if( !InclusionListStt[ ListSttParHits[i] ] ) continue;
1762 // check if the hit position is near the circle of the Helix found by the fit
1763 
1764  dx = -Oxx+info[ListSttParHits[i]][0];
1765  dy = -Oyy+info[ListSttParHits[i]][1];
1766  angle=atan2(dy,dx);
1767  if(angle<0.) angle += 2.*PI;
1768  if(angle<0.) angle =0.;
1769  distance = sqrt(dx*dx+dy*dy);
1770  if ( fabs(Rr - distance ) > NTIMES*STRAWRADIUS ) continue;
1771  if(angle<Fi_low) angle += 2.*PI;
1772  if(angle>Fi_up) continue;
1773  auxListHitsinTrack[nAssociatedHits]= ListSttParHits[i];
1774  nAssociatedHits++;
1775  } // end for(i=0; i<NhitsParallel;i++)
1776 
1777  return nAssociatedHits;
1778 
1779 };
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t
const Double_t STRAWRADIUS
#define PI
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
double dx
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Double_t angle
Short_t PndTrkCTFindTrackInXY::TrkAssociatedParallelHitsToHelixQuater ( Short_t *  auxListHitsinTrack,
Double_t  deltanr,
Short_t *  FiConformalIndex,
Short_t *  HitsinBoxConformal,
bool *  InclusionListStt,
Double_t  info[][7],
Double_t  infoparalConformal[][5],
Short_t *  ListHitsinTrack,
Double_t  m,
Short_t  MAXSTTHITS,
Short_t *  nBoxConformal,
Short_t  nfidivconformal,
Short_t  nHitsinTrack,
Int_t  NhitsParallel,
Short_t  nrdivconformal,
Double_t  Oxx,
Double_t  Oyy,
Double_t  q,
Double_t radiaConf,
Short_t *  RConformalIndex,
Double_t  Rr,
Double_t  rstrawdetectormin,
Short_t  Status,
Double_t  strawradius 
)

Definition at line 1244 of file PndTrkCTFindTrackInXY.cxx.

References angle, atan2(), cos(), Double_t, dx, dy, fabs(), i, PI, r, sin(), and sqrt().

1270 {
1271 
1272 
1273  bool
1274  passamin,
1275  passamax,
1276  Unselected[maxstthits]; // this has to be at least nSttHits large.
1277  Short_t i, i2, j, k, l, l2, l3, itemp, kstart, kend,
1278  iFi0,FFimin, FFimax;
1279  Short_t Nextra=8,
1280  //nFi, //[R.K. 01/2017] unused variable?
1281  Fi,
1282  nR,
1283  nAssociatedHits,
1284  nHit_original;
1285  Double_t //maxFi, //[R.K. 01/2017] unused variable?
1286  //minFi, //[R.K. 01/2017] unused variable?
1287  dist,
1288  xx,
1289  yy,
1290  aaa,
1291  angle,
1292  r,
1293  erre1,
1294  erre2,
1295  Rin,
1296  Rout,
1297  Fi0,
1298  ddd,
1299  fi1,
1300  fi2,
1301  dx,
1302  dy,
1303  distance,
1304  NTIMES=1.5; // number of Straw radia allowed in association
1305 
1306 
1307 
1308  nAssociatedHits=0;
1309 
1310 
1311  size_t len = sizeof(Unselected);
1312  memset (Unselected,true,len);
1313 
1314 
1315 // find the range in Fi spanned by the candidate track
1316 
1317  FFimin = 10000;
1318  FFimax = 0;
1319 
1320  for(j=0; j<nHitsinTrack; j++){
1321  i = ListHitsinTrack[j];
1322 
1323 
1324  if( FiConformalIndex[i] < FFimin ) FFimin = FiConformalIndex[i];
1325  if( FiConformalIndex[i] > FFimax ) FFimax = FiConformalIndex[i];
1326  } // end of for(j=0; j<nHitsinTrack; j++)
1327 
1328 
1329 
1330 
1331 // -------- here treat the case in which a trajectory crosses the ascissa in the
1332 // conformal plane and consequently FFimin is close to zero while FFimax is close
1333 // to the maximum number possible (=nfid); in other words FFimin and FFimax are
1334 // wrong;
1335 
1336  if( FFimax > 3.*nfid/4. && FFimin < nfid/4.) {
1337  FFimin = 10000;
1338  FFimax = 0;
1339  for(j=0; j<nHitsinTrack; j++){
1340  i = ListHitsinTrack[j];
1341  Fi = FiConformalIndex[i];
1342  if( Fi < nfid/4. ) Fi = FiConformalIndex[i]+nfid;
1343  if( Fi < FFimin ) FFimin = Fi;
1344  if( Fi > FFimax ) FFimax = Fi;
1345  }
1346  }
1347 
1348 
1349 // finding the boundaries in the Conformal plane. The basic assumption is that the range
1350 // in Fi is much less that 180 degrees.
1351 
1352  FFimin -= (Short_t) nfid/Nextra;
1353  FFimax += (Short_t) nfid/Nextra;
1354 if( FFimax - FFimin > nfid/2 ) {
1355  cout<<"something fishy is going on in TrkAssociatedParallelHitsToHelixQuater!"
1356  <<"Range in Fi (rad) is "<<(FFimax - FFimin)*2.*PI/nfid<<endl;
1357  return 0;
1358 }
1359 
1360 
1361 // use the equation of a line in polar coordinates
1362 
1363  if( Status ==99) { // case in which 0 = x + q
1364 
1365  if(fabs(q) > 1.e-10 ) {
1366  passamax=false;
1367  passamin=false;
1368  for(itemp=FFimin; itemp<=FFimax;itemp++){
1369  i=itemp;
1370  if( i< 0 ) {
1371  i += nfid;
1372  } else if (i>=nfid){
1373  i -= nfid*( i/nfid );
1374  }
1375  angle = (i+0.5)*2.*PI/nfid;
1376  aaa = cos(angle);
1377  if( fabs(cos(angle)) <1.e-10) continue;
1378  r = -q/aaa;
1379  if(r< radiaConf[0] || r>= 1./rstrawdetectormin) continue;
1380  for(j=nrd-1; j>=0;j--){
1381  if( r>= radiaConf[j] ){
1382  nR = j;
1383  break;
1384  }
1385  }
1386 
1387 
1388  for(l=(Short_t) (-deltanr) ; l<(Short_t)deltanr+1;l++){
1389  l2 = nR+l;
1390  if( l2<0 || l2 >= nrd ) continue;
1391  for( k=0;k<*(nBoxConformal+l2*nrd+i);k++){
1392  nHit_original = (Short_t)
1393  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l2*nfid+i)][3];
1394  if( !InclusionListStt[ nHit_original ] ) continue;
1395 // check if the hit position is near the circle of the Helix found by the fit
1396  dx = -Oxx+info[ nHit_original ][0];
1397  dy = -Oyy+info[ nHit_original ][1];
1398  distance = sqrt(dx*dx+dy*dy);
1399  if ( fabs(Rr - distance ) > NTIMES*STRAWRADIUS ) continue;
1400 
1401 //-------------------
1402  xx=infoparalConformal[ *(HitsinBoxConformal+k*nrd*nfid+l2*nfid+i) ][0];
1403  dist = fabs( xx +q );
1404  if( AcceptHitsConformal( dist,
1405  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l2*nfid+i)][2],
1406  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l2*nfid+i)][4]
1407  ) ) {
1408  auxListHitsinTrack[nAssociatedHits]= *(HitsinBoxConformal+k*nrd*nfid+l2*nfid+i);
1409  nAssociatedHits++;
1410  }
1411  } // end of for( k=0;k<*(nBoxConformal....
1412  } // end of for(l=(Short_t)(-deltanr);l<(Short_t)deltanr+1;l++)
1413 
1414 
1415  //------- special cases
1416  if((nR == nrd-1 && passamin && ! passamax) || (nR==0 && passamax && !passamin) ) { // do the last two Fi columns
1417  if(nR == nrd-1) passamax=true;
1418  if(nR == 0) passamin=true;
1419 
1420  for(l2=1;l2<3;l2++){
1421  i2 = i+l2;
1422  if(i2>=nfid) i2 -= nfid;
1423  for(l=-2; l<3;l++){
1424  l3 = nR+l;
1425  if( l3<0 || l3 >= nrd ) continue;
1426  for( k=0;k<*(nBoxConformal+l3*nfid+i2);k++){
1427  nHit_original = (Short_t)
1428  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2)][3];
1429  if( !InclusionListStt[ nHit_original ] ) continue;
1430 // check if the hit position is near the circle of the Helix found by the fit
1431  dx = -Oxx+info[ nHit_original ][0];
1432  dy = -Oyy+info[ nHit_original ][1];
1433  distance = sqrt(dx*dx+dy*dy);
1434  if ( fabs(Rr - distance ) > NTIMES*STRAWRADIUS ) continue;
1435 
1436 //-------------------
1437  xx=infoparalConformal[ *(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2) ][0];
1438  dist = fabs( xx +q );
1439 // if(dist < 3.*infoparalConformal[ *(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2) ][2]){
1440  if( AcceptHitsConformal( dist,
1441  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2)][2],
1442  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2)][4]
1443  ) ) {
1444  auxListHitsinTrack[nAssociatedHits]= *(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2);
1445  nAssociatedHits++;
1446  }
1447  } // end of for( k=0;k<*(nBoxConformal....
1448  } // end of for(l=-2; l<3;l++)
1449  } // end of for(l2=0;l2<2;l2++)
1450  return nAssociatedHits;
1451  } else if ((nR == nrd-1 && ! passamin && !passamax) || (nR==0 && !passamax && !passamin)){
1452  if(nR == nrd-1) passamax=true;
1453  if(nR == 0) passamin=true;
1454 
1455  for(l2=1;l2<3;l2++){
1456  i2 = i-l2;
1457  if(i2<nfid) i2 += nfid;
1458  for(l=-2; l<3;l++){
1459  l3 = nR+l;
1460  if( l3<0 || l3 >= nrd ) continue;
1461  for( k=0;k<*(nBoxConformal+l3*nfid+i2);k++){
1462  nHit_original = (Short_t)
1463  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2)][3];
1464  if( !InclusionListStt[ nHit_original ] ) continue;
1465 // check if the hit position is near the circle of the Helix found by the fit
1466  dx = -Oxx+info[ nHit_original ][0];
1467  dy = -Oyy+info[ nHit_original ][1];
1468  distance = sqrt(dx*dx+dy*dy);
1469  if ( fabs(Rr - distance ) > NTIMES*STRAWRADIUS ) continue;
1470 
1471 //-------------------
1472  xx=infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2)][0];
1473  dist = fabs( xx +q );
1474 // if(dist < 3.*infoparalConformal[ *(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2) ][2]){
1475  if( AcceptHitsConformal( dist,
1476  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2)][2],
1477  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2)][4]
1478  ) ) {
1479  auxListHitsinTrack[nAssociatedHits]= *(HitsinBoxConformal+k*nrd*nfid+l3*nfid+i2);
1480  nAssociatedHits++;
1481  }
1482  } // end of for( k=0;k<*(nBoxConformal.....
1483  } // end of for(l=-2; l<3;l++)
1484  } // end of for(l2=0;l2<2;l2++)
1485  } // end of if((nR == nrd-1 && passamin) || (nR==0 && passamax) )
1486 
1487 
1488 
1489  } // end of for(itemp=FFimin; itemp<=FFimax;itemp++)
1490 
1491 
1492  } else { // q=0 --> x=0
1493 
1494 
1495 
1496  if( FFimax > nrd/4 && FFimin < nrd/4 ) {
1497  iFi0 = (Short_t) (nrd/4 );
1498  } else if ( FFimax > 3*nrd/4 && FFimin < 3*nrd/4 ){
1499  iFi0 = (Short_t) (3*nrd/4 );
1500  } else {
1501  cout <<"From TrkAssociatedParallelHitsToHelixQuater :"
1502  <<" inconsistency, 0 associated hits to this track candidate\n";
1503  return 0;
1504  }
1505 
1506  for(itemp=iFi0-5; itemp<=iFi0+5;itemp++){
1507  i=itemp;
1508  if( i< 0 ) {
1509  i += nfid;
1510  } else if (i>=nfid){
1511  i -= nfid*( i/nfid );
1512 // i -= nfid;
1513  }
1514  for(l=0; l<nrd;l++){
1515  for( k=0;k<*(nBoxConformal+l*nfid+i);k++){
1516  nHit_original = (Short_t)
1517  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][3];
1518  if( !InclusionListStt[ nHit_original ] ) continue;
1519 // check if the hit position is near the circle of the Helix found by the fit
1520  dx = -Oxx+info[ nHit_original ][0];
1521  dy = -Oyy+info[ nHit_original ][1];
1522  distance = sqrt(dx*dx+dy*dy);
1523  if ( fabs(Rr - distance ) >NTIMES*STRAWRADIUS ) continue;
1524 
1525 //-------------------
1526  xx=infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][0];
1527  dist = fabs( xx );
1528 
1529  if( AcceptHitsConformal( dist,
1530  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][2],
1531  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][4]
1532  ) ) {
1533  auxListHitsinTrack[nAssociatedHits]=*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i);
1534  nAssociatedHits++;
1535  }
1536  } // end of for( k=0;k<*(nBoxConformal...
1537  } // end of for(l=0; l<nrd;l++)
1538  } // end of for(itemp=iFi0-5; itemp<=iFi0+5;itemp++)
1539 
1540 
1541 
1542 
1543  } // end of if(fabs(q) > 1.e-10 )
1544 
1545 
1546  } else if( fabs(q)> 1.e-10) { // second part of if( Status ==99), in this case y = m*x +q
1547 
1548 
1549  Fi0 = atan(m); // Fi0 belongs to (-PI/2, PI/2] .
1550  aaa = atan2(q, -m*q);
1551  if(Fi0<0.) {
1552  Fi0 += PI;
1553  if (Fi0 <0. ) Fi0 =0.;// this is between 0. and PI.
1554  if (Fi0 >PI ) Fi0 =PI;// this is between 0. and PI.
1555  };
1556  ddd= fabs(q)/sqrt(1.+m*m);
1557 
1558 
1559  for(itemp=FFimin; itemp<=FFimax;itemp++){
1560  i=itemp;
1561  if( i< 0 ) {
1562  i += nfid;
1563  } else if (i>=nfid){
1564  i -= nfid*( i/nfid );
1565  }
1566 
1567  // erre1 is the distance from origin of point of intersection of the straight
1568  // line of equation y= m*x+q with line of equation y = x*tan(fi1);
1569  // when erre1 is < 0 it means the intersection is on the opposite side of the
1570  // versor defined by [cos(fi1); sin(fi1)].
1571  // Here we are working in the conformal plane U,V.
1572 
1573  fi1 = i*2.*(PI/nfid);
1574  if( fabs(sin(fi1)-m*cos(fi1))>1.e-10) {
1575  erre1 = q/(sin(fi1)-m*cos(fi1));
1576  } else {
1577  erre1 = 99999999999.;
1578  }
1579 
1580  fi2 = (i+1)*2.*(PI/nfid);
1581  if( fabs(sin(fi2)-m*cos(fi2))>1.e-10) {
1582  erre2 = q/(sin(fi2)-m*cos(fi2));
1583  } else {
1584  erre2 = 99999999999.;
1585  }
1586 
1587 
1588  for(j=0; j<nrd; j++){
1589 
1590  Rin = radiaConf[j];
1591  if(j!=nrd-1) {
1592  Rout = radiaConf[j+1];
1593  } else {
1594  Rout = 1./rstrawdetectormin;
1595  }
1596 
1597 // note that the following algorithm works also for negative erre1 and erre2
1598 
1599 
1600  if(erre1<-1.e-10 ){
1601  if(erre2< 0. || erre2 > Rout ){
1602  continue;
1603  }
1604  } else if(fabs(erre1) < 1.e-10){
1605  if( Fi0 > fi2 || Fi0 < fi1){
1606  continue;
1607  }
1608  } else if ( erre1<Rin) {
1609  if( erre2< Rin && erre2> 0. ) {
1610  continue;
1611  }
1612  } else if (erre1> Rout && erre2 > Rout &&
1613  !( fi1<= aaa && aaa<=fi2 && ddd<=Rout )
1614  ) {
1615  continue;
1616  }
1617 
1618  for(l=itemp-2; l<=itemp+2; l++){
1619  if( l< 0 ) {
1620  l2 = l+nfid;
1621  } else if (l>=nfid){
1622  l2 = l- nfid*( l/nfid );
1623  } else {
1624  l2 = l;
1625  }
1626  if( j-1<0) {
1627  kstart=0;
1628  } else {
1629  kstart = j-1;
1630  }
1631  if ( j+1 >= nrd ) {
1632  kend = nrd;
1633  } else {
1634  kend = j+2;
1635  }
1636 
1637  for(k=kstart;k<kend;k++){
1638 
1639  for( l3=0;l3<*(nBoxConformal+k*nfid+l2);l3++){
1640  if( ! Unselected[*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2)] ) continue;
1641  nHit_original = (Short_t) infoparalConformal
1642  [*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2)][3];
1643 
1644  if( !InclusionListStt[ nHit_original ] ) continue;
1645 // check if the hit position is near the circle of the Helix found by the fit
1646  dx = -Oxx+info[ nHit_original ][0];
1647  dy = -Oyy+info[ nHit_original ][1];
1648  distance = sqrt(dx*dx+dy*dy);
1649  if ( fabs(Rr - distance ) > NTIMES*STRAWRADIUS ) continue;
1650 
1651 //-------------------
1652  xx=infoparalConformal[*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2)][0];
1653  yy=infoparalConformal[*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2)][1];
1654  dist = fabs( -yy+ m*xx +q )/sqrt(m*m+1.);
1655  if( AcceptHitsConformal( dist,
1656  infoparalConformal[*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2)][2],
1657  infoparalConformal[*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2)][4]
1658  ) ) {
1659 
1660  auxListHitsinTrack[nAssociatedHits]=*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2);
1661  Unselected[*(HitsinBoxConformal+l3*nrd*nfid+k*nfid+l2)]= false;
1662  nAssociatedHits++;
1663  }
1664 
1665  } // end of for( l3=0;l3<*(nBoxConformal...
1666  } // end of for(k=kstart;k<kend;k++)
1667  } // end of for(l=itemp-1; l<itemp+2; l++)
1668 
1669  } // end of for(j=0; j<nrd; j++)
1670 
1671  } // end of for(itemp=FFimin; itemp<=FFimax;itemp++)
1672 
1673 
1674 
1675 
1676  } else { // case in which y= m*x , m can be zero , third part of if( Status ==99)
1677  iFi0 = (Short_t) (atan(m)*nrd/(2.*PI) );
1678  for(itemp=iFi0-5; itemp<=iFi0+5;itemp++){
1679  i=itemp;
1680  if( i< 0 ) {
1681  i += nfid;
1682  } else if (i>=nfid){
1683  i -= nfid*( i/nfid );
1684  }
1685  for(l=0; l<nrd;l++){
1686  for( k=0;k<*(nBoxConformal+l*nfid+i);k++){
1687  nHit_original = (Short_t)
1688  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][3];
1689  if( !InclusionListStt[ nHit_original ] ) continue;
1690 // check if the hit position is near the circle of the Helix found by the fit
1691  dx = -Oxx+info[ nHit_original ][0];
1692  dy = -Oyy+info[ nHit_original ][1];
1693  distance = sqrt(dx*dx+dy*dy);
1694  if ( fabs(Rr - distance ) > NTIMES*STRAWRADIUS ) continue;
1695 
1696 //-------------------
1697  xx=infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][0];
1698  yy=infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][1];
1699  dist = fabs( m*xx-yy )/sqrt( m*m+1.);
1700  if( AcceptHitsConformal( dist,
1701  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][2],
1702  infoparalConformal[*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i)][4]
1703  ) ) {
1704  auxListHitsinTrack[nAssociatedHits]=*(HitsinBoxConformal+k*nrd*nfid+l*nfid+i);
1705  nAssociatedHits++;
1706  }
1707  } // end of for( k=0;k<*(nBoxConformal
1708  }
1709  } // end of for(itemp=FFimin; itemp<=FFimax;itemp++)
1710 
1711 
1712 
1713 
1714 
1715  } // end of if ( Status ==99)
1716 
1717 
1718 
1719  return nAssociatedHits;
1720 
1721 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double dy
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
bool AcceptHitsConformal(Double_t distance, Double_t DriftConfR, Double_t StrawConfR)
Double_t
const Double_t STRAWRADIUS
#define PI
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
double dx
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Double_t angle

The documentation for this class was generated from the following files: