FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PndSttTrackFinderReal Class Reference

#include <PndSttTrackFinderReal.h>

Inheritance diagram for PndSttTrackFinderReal:
PndSttTrackFinder

Public Member Functions

 PndSttTrackFinderReal ()
 
 PndSttTrackFinderReal (Int_t verbose)
 
 PndSttTrackFinderReal (int istamp, bool iplot, bool doMcComparison)
 
 PndSttTrackFinderReal (int istamp, bool iplot, bool doMcComparison, bool doSciTil)
 
virtual ~PndSttTrackFinderReal ()
 
virtual void Init ()
 
void WriteHistograms ()
 
virtual Int_t DoFind (TClonesArray *trackCandArray, TClonesArray *trackArray, TClonesArray *helixHitArray)
 
virtual Int_t DoFind (TClonesArray *mHitArray, TClonesArray *mHelixHitArray)
 
virtual void AddHitCollection (TClonesArray *mHitArray, TClonesArray *mPointArray)
 
void SetTubeArray (TClonesArray *tubeArray)
 
void SetInputBranchName (char *string1)
 
void Finish ()
 
void SetVerbose (Int_t verbose)
 
void SetHelixHitProduction (Bool_t hhprod)
 

Protected Member Functions

 ClassDef (PndSttTrackFinder, 1)
 

Protected Attributes

Int_t fVerbose
 
Bool_t fHelixHitProduction
 

Private Member Functions

PndSttHitGetHitFromCollections (Int_t hitCounter)
 
FairMCPoint * GetPointFromCollections (Int_t hitCounter)
 
void Initialization_ClassVariables ()
 
void PndSttFromXYtoConformal (Double_t trajectory_vertex[3], Double_t info[][7], Int_t Nparal, Double_t infoparalConformal[][5], Int_t *status)
 
void PndSttFromXYtoConformal2 (Double_t trajectory_vertex[3], Short_t nHitsinTrack, Short_t iExclude, Short_t *ListHits, Double_t info[][7], Double_t auxinfoparalConformal[][5], Int_t *status)
 
void PndSttBoxConformalFilling (bool ExclusionList[nmaxHits], Double_t infoparalConformal[][5], Int_t Nparal, Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t RConformalIndex[nmaxHits], Short_t FiConformalIndex[nmaxHits])
 
void Merge_Sort (Short_t n_ele, Double_t *array, Short_t *ind)
 
void Merge (Short_t nl, Double_t *left, Short_t *ind_left, Short_t nr, Double_t *right, Short_t *ind_right, Double_t *result, Short_t *ind)
 
Short_t PndSttFindTrackPatterninBoxConformal (Short_t NRCELLDISTANCE, Short_t NFiCELLDISTANCE, Short_t Nparal, Short_t ihit, Short_t nRcell, Short_t nFicell, Double_t info[][7], bool Exclusion_List[nmaxHits], Short_t RConformalIndex[nmaxHits], Short_t FiConformalIndex[nmaxHits], Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t *ListHitsinTrack)
 
Short_t PndSttFindTrackPatterninBoxConformalSpecial (Short_t NRCELLDISTANCE, Short_t NFiCELLDISTANCE, Short_t Nparal, Short_t NparallelToSearch, Short_t iSeed, Short_t *ListHitsinTrackinWhichToSearch, Double_t info[][7], bool InclusionList[nmaxHits], Short_t RConformalIndex[nmaxHits], Short_t FiConformalIndex[nmaxHits], Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t *OutputListHitsinTrack)
 
Short_t PndSttFindTrackStrictCollection (Short_t NFiCELLDISTANCE, Short_t iSeed, Short_t NParallelToSearch, Short_t *ListHitsinTrackinWhichToSearch, bool ExclusionList[nmaxHits], Short_t FiConformalIndex[nmaxHits], Short_t *OutputListHitsinTrack)
 
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, Short_t NMAX, Double_t *m, Double_t *q, Double_t *ALFA, Double_t *BETA, Double_t *GAMMA, bool *TypeConf)
 
Short_t PndSttFitSZspacebis (Short_t nSttSkewhitinTrack, Double_t *S, Double_t *Z, Double_t *DriftRadius, Double_t FInot, Short_t NMAX, Double_t *m)
 
Short_t FitSZspace (Short_t nSkewHitsinTrack, Double_t *S, Double_t *Z, Double_t *DriftRadius, Double_t *ErrorDriftRadius, Double_t FInot, Short_t NMAX, Double_t *emme)
 
Short_t PndSttTrkAssociatedParallelHitsToHelix (Double_t Ox, Double_t Oy, Double_t R, Int_t Nhits, Double_t info[][7], Short_t *auxListHitsinTrack)
 
Short_t PndSttTrkAssociatedParallelHitsToHelixQuater (bool ExclusionList[nmaxHits], Double_t m, Double_t q, Short_t Status, Short_t nHitsinTrack, Short_t *ListHitsinTrack, Int_t NhitsParallel, Double_t Ox, Double_t Oy, Double_t R, Double_t info[][7], Double_t infoparalConformal[][5], Short_t *RConformalIndex, Short_t *FiConformalIndex, Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t *auxListHitsinTrack)
 
Short_t PndSttTrkAssociatedParallelHitsToHelix5 (bool ExclusionList[nmaxHits], Int_t NhitsParallel, Double_t Ox, Double_t Oy, Double_t R, Double_t info[][7], Double_t Fi_low, Double_t Fi_up, Short_t *auxListHitsinTrack)
 
bool PndSttAcceptHitsConformal (Double_t distance, Double_t DriftConfR, Double_t StrawConfR)
 
CalculatedCircles PndSttTrkFindCircles (Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, Double_t, Double_t)
 
CalculatedHelix PndSttTrkFindHelix (Double_t Ox, Double_t Oy, Double_t R, Double_t Zcenter1, Double_t Zcenter2, Double_t Zcenter3, Double_t semilengthStraight1, Double_t semilengthStraight2, Double_t semilengthStraight3, Double_t C0x1, Double_t C0y1, Double_t C0z1, Double_t semilengthSkew1, Double_t r1, Double_t vx1, Double_t vy1, Double_t vz1, Double_t C0x2, Double_t C0y2, Double_t C0z2, Double_t semilengthSkew2, Double_t r2, Double_t vx2, Double_t vy2, Double_t vz2, Int_t *STATUS)
 
void calculateintersections (Double_t Ox, Double_t Oy, Double_t R, 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)
 
void plottamentiParalleleGenerali (Int_t Nremaining, Float_t *RemainingR, Float_t *RemainingD, Float_t *RemainingFi, Float_t *RemainingCX, Float_t *RemainingCY, bool *Goodflag)
 
void plottamentiParalleleconMassimo (char *tipo, Int_t nMaxima, Int_t Nremaining, Float_t *RemainingR, Float_t *RemainingD, Float_t *RemainingFi, Float_t *RemainingCX, Float_t *RemainingCY, Double_t Rup, Double_t Rlow, Double_t Dup, Double_t Dlow, Double_t Fiup, Double_t Filow)
 
bool iscontiguous (int ncomponents, Short_t *vec1, Short_t *vec2)
 
void clustering2 (Short_t vec1[2], int nListElements, Short_t List[][2], int &nClusterElementsFound, Short_t ClusterElementsFound[][2], int &nRemainingElements, Short_t RemainingElements[][2])
 
void clustering3 (Short_t vec1[3], int nListElements, Short_t List[][3], int &nClusterElementsFound, Short_t ClusterElementsFound[][3], int &nRemainingElements, Short_t RemainingElements[][3])
 
void WriteMacroParallelAssociatedHits (Double_t Ox, Double_t Oy, Double_t R, Short_t Nhits, Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Short_t imaxima, Int_t sequencial, Short_t nscitilhitsintrack, Short_t *listscitilhitsintrack)
 
void WriteMacroParallelAssociatedHitswithMC (Double_t Ox, Double_t Oy, Double_t R, Short_t TrackFoundaTrackMC, Short_t Nhits, Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Double_t info[][7], Short_t ifoundtrack, Int_t sequentialNTrack, Short_t nscitilhitsintrack, Short_t *listscitilhitsintrack, Short_t nParalCommon[MAXTRACKSPEREVENT], Short_t ParalCommonList[MAXTRACKSPEREVENT][nmaxHits], Short_t nSpuriParinTrack[MAXTRACKSPEREVENT], Short_t ParSpuriList[MAXTRACKSPEREVENT][nmaxHits], Short_t nMCParalAlone[MAXTRACKSPEREVENT], Short_t MCParalAloneList[MAXTRACKSPEREVENT][nmaxHits])
 
void WriteMacroParallelHitsGeneral (bool *keepit, Int_t Nhits, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Short_t nTracksFoundSoFar)
 
void WriteMacroParallelHitsGeneralConformalwithMC (bool *keepit, Int_t Nhits, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Short_t nTracksFoundSoFar)
 
void WriteMacroParallelHitsConformalwithMCspecial (Int_t Nhits, Double_t auxinfoparalConformal[][5], Short_t nTracksFoundSoFar, Short_t Status, Double_t *trajectory_vertex)
 
void WriteMacroSkewAssociatedHits (bool goodskewfit, Double_t KAPPA, Double_t FI0, Double_t D, Double_t Fi, Double_t R, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Int_t imaxima, Int_t sequentialNTrack, Short_t nSttSkewhitinTrack, Short_t ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t nscitilhits, Double_t *ESSE, Double_t *ZETA)
 
void WriteMacroSkewAssociatedHitswithMC (bool goodskewfit, Double_t KAPPA, Double_t FI0, Double_t D, Double_t Fi, Double_t R, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Int_t imaxima, Int_t sequentialNTrack, Short_t nSttSkewhitinTrack, Short_t ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t nSkewCommon, Short_t SkewCommonList[MAXTRACKSPEREVENT][nmaxHits], Short_t daTrackFoundaTrackMC, Short_t nMCSkewAlone[MAXTRACKSPEREVENT], Short_t MCSkewAloneList[MAXTRACKSPEREVENT][nmaxHits], Short_t nscitilhits, Double_t *ESSE, Double_t *ZETA)
 
Short_t AssociateSkewHitsToXYTrack (bool *ExclusionListSkew, Double_t Ox, Double_t Oy, Double_t R, Double_t info[][7], Double_t inclination[][3], Double_t Fi_low_limit, Double_t Fi_up_limit, Short_t Charge, Double_t Fi_initial_helix_referenceframe, Double_t Fi_final_helix_referenceframe, Short_t SkewList[nmaxHits][2], Double_t *S, Double_t *Z, Double_t *ZDrift, Double_t *ZRadiusafterTilt)
 
Short_t AssociateBetterAfterFitSkewHitsToXYTrack (Short_t TemporarynSttSkewhitinTrack, Short_t SkewList[nmaxHits][2], Double_t *S, Double_t *Z, Double_t *ZDrift, Double_t *ZRadiusafterTilt, Double_t KAPPA, Double_t FI0, Short_t *tempore, Double_t *temporeS, Double_t *temporeZ, Double_t *temporeZDrift, Double_t *temporeZErrorafterTilt, Int_t *STATUS)
 
void PndSttOrderingParallel (Double_t oX, Double_t oY, Double_t info[][7], Short_t nParallelHits, Short_t *ListParallelHits, Short_t *Infoparal, Short_t Charge, Double_t *Fi_initial_helix_referenceframe, Double_t *Fi_final_helix_referenceframe, Double_t *U, Double_t *V)
 
void PndSttOrderingSkewandParallel (Short_t *Infoparal, Short_t *Infoskew, Double_t oX, Double_t oY, Double_t Rr, Short_t nSttSkewhit, Short_t *ListSkewHits, Double_t *SList, Short_t Charge, Short_t nParHits, Short_t *ListParHits, Double_t *U, Double_t *V, Short_t *BigList)
 
void PndSttOrdering (Double_t oX, Double_t oY, Double_t info[][7], Short_t nParallelHits, Short_t *ListParallelHits, Short_t nSttSkewhit, Short_t *ListSkewHits, Double_t *S, Short_t *Infoparal, Short_t *Infoskew, Short_t *nTotal, Short_t *BigList, Short_t *Charge)
 
void PndSttFindingParallelTrackAngularRange (Double_t oX, Double_t oY, Double_t r, Short_t Charge, Double_t *Fi_low_limit, Double_t *Fi_up_limit, Short_t *status, Double_t Rmin, Double_t Rmax)
 
void WriteMacroParallelHitswithRfromMC (Int_t Nhits, Double_t info[][7], Short_t nTracksFoundSoFar, Double_t *Ox, Double_t *Oy, Short_t *daParTrackFoundaTrackMC)
 
void WriteMacroSkewAssociatedHitswithRfromMC (Double_t KAPPA, Double_t FI0, Double_t D, Double_t Fi, Double_t R, Int_t Nhits, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Int_t imaxima, Int_t nMaxima)
 
void AssociateFoundTrackstoMC (Double_t info[][7], Short_t nTracksFoundSoFar, Short_t *nHitsinTrack, Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHits], Short_t *nSttSkewhitinTrack, Short_t ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHits], Short_t daTrackFoundaTrackMC[MAXTRACKSPEREVENT])
 
void AssociateFoundTrackstoMCbis (bool *keepit, Double_t info[][7], Short_t nTracksFoundSoFar, Short_t nHitsinTrack[MAXTRACKSPEREVENT], Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t nSttSkewhitinTrack[MAXTRACKSPEREVENT], Short_t ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t daTrackFoundaTrackMC[MAXTRACKSPEREVENT])
 
void PndSttInfoXYZParal (Double_t info[][7], Short_t infopar, Double_t Ox, Double_t Oy, Double_t R, Double_t KAPPA, Double_t FI0, Short_t Charge, Double_t *Posiz)
 
void PndSttInfoXYZSkew (Double_t Z, Double_t ZDrift, Double_t S, Double_t Ox, Double_t Oy, Double_t R, Double_t KAPPA, Double_t FI0, Short_t Charge, Double_t *Posiz)
 
void FixDiscontinuitiesFiangleinSZplane (Short_t TemporarynSttSkewhitinTrack, Double_t *S, Double_t *Fi_initial_helix_referenceframe, Short_t Charge)
 
void FindCharge (Double_t oX, Double_t oY, Short_t nParallelHits, Double_t *X, Double_t *Y, Short_t *Charge)
 
bool SttParalCleanup (Double_t GAP, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t FI0, Double_t FiLimitAdmissible, Short_t nHits, Short_t *Listofhits, Double_t info[][7], Double_t RStrawDetMin, Double_t RStrawDetInnerParMax, Double_t RStrawDetOuterParMin, Double_t RStrawDetMax)
 
bool SttSkewCleanup (Double_t GAP, Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Start[3], Double_t FI0, Double_t FiLimitAdmissible, Short_t nHits, Short_t *Listofhits, Double_t *S, Double_t info[][7], Double_t RminStrawSkew, Double_t RmaxStrawSkew, Double_t cut, Short_t maxnum)
 
bool BadTrack_ParStt (Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Xcross[2], Double_t Ycross[2], Short_t nHits, Short_t *ListHits, Double_t info[][7], Double_t cut, Short_t maxnum, Short_t islack)
 
Short_t IntersectionsWithClosedPolygon (Double_t Ox, Double_t Oy, Double_t R, Double_t Rmi, Double_t Rma, Short_t nIntersections[2], Double_t XintersectionList[][2], Double_t YintersectionList[][2])
 
Short_t IntersectionsWithOpenPolygon (Double_t Ox, Double_t Oy, Double_t R, 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)
 
Short_t IntersectionsWithClosedbiHexagonLeft (Double_t vgap, Double_t Ox, Double_t Oy, Double_t R, Double_t Ami, Double_t Ama, Short_t *nIntersections, Double_t *XintersectionList, Double_t *YintersectionList)
 
Short_t IntersectionsWithClosedbiHexagonRight (Double_t vgap, Double_t Ox, Double_t Oy, Double_t R, Double_t Ami, Double_t Ama, Short_t *nIntersections, Double_t *XintersectionList, Double_t *YintersectionList)
 
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 Ox, Double_t Oy, Double_t R, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
 
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])
 
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)
 
bool IsInternal (Double_t Px, Double_t Py, Double_t Xtraslation, Double_t Ytraslation, Double_t Theta)
 
void ChooseEntranceExit (Double_t Oxx, Double_t Oyy, Short_t flag, Short_t Charge, Double_t FiStart, Short_t nIntersections[2], Double_t XintersectionList[][2], Double_t YintersectionList[][2], Double_t Xcross[2], Double_t Ycross[2])
 
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])
 
Short_t FindTrackEntranceExitbiHexagon (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])
 
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])
 
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 SeparateInnerOuterParallel (Short_t nHits, Short_t *ListHits, Double_t info[][7], Double_t RStrawDetInnerParMax, Short_t *nInnerHits, Short_t *ListInnerHits, Short_t *nOuterHits, Short_t *ListOuterHits, Short_t *nInnerHitsLeft, Short_t *ListInnerHitsLeft, Short_t *nInnerHitsRight, Short_t *ListInnerHitsRight, Short_t *nOuterHitsLeft, Short_t *ListOuterHitsLeft, Short_t *nOuterHitsRight, Short_t *ListOuterHitsRight)
 
Short_t FindTrackEntranceExitHexagonCircle (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])
 
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])
 
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])
 
Short_t FindIntersectionsOuterCircle (Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t RMax, Double_t Xcross[2], Double_t Ycross[2])
 
bool IsInsideArc (Double_t Oxx, Double_t Oyy, Short_t Charge, Double_t Xcross[2], Double_t Ycross[2], Double_t Spoint)
 
bool IsInTargetPipe (Double_t Oxx, Double_t Oyy, Double_t Rr, Double_t fi0, Double_t kappa, Short_t charge, Double_t gap)
 
Double_t CalculateArcLength (Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t Charge, Double_t Xcross[2], Double_t Ycross[2])
 
void OrderingUsingConformal (Double_t oX, Double_t oY, Int_t nHits, Double_t XY[][2], Int_t Charge, Short_t *ListHits)
 
bool FindTrackInXYProjection (Short_t iHit, Short_t nRcell, Short_t nFicell, Int_t *Minclinations, Double_t info[nmaxHits][7], bool *ExclusionList, Short_t *RConformalIndex, Short_t *FiConformalIndex, Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[MAXHITSINCELL][nRdivConformal][nFidivConformal], Short_t nTracksFoundSoFar, Short_t *nHitsinTrack, Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Double_t *trajectory_vertex, Double_t infoparalConformal[nmaxHits][5], Double_t posizSciTilx, Double_t posizSciTily, Double_t *S, Double_t *Ox, Double_t *Oy, Double_t *R, Double_t *Fi_low_limit, Double_t *Fi_up_limit, Double_t *Fi_initial_helix_referenceframe, Double_t *Fi_final_helix_referenceframe, Short_t *Charge, Double_t *U, Double_t *V)
 
Short_t AssociateSciTilHit (Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t *List, Double_t *esse)
 
void disegnaSciTilHit (FILE *MACRO, int ScitilHit, double posx, double posy, int tipo)
 
void disegnaAssiXY (FILE *MACRO, double xmin, double xmax, double ymin, double ymax)
 
 ClassDef (PndSttTrackFinderReal, 1)
 

Private Attributes

bool YesSciTil
 
bool InclusionListSciTil [nmaxSciTilHits]
 
int IVOLTE
 
bool iplotta
 
bool doMcComparison
 
bool TypeConf [MAXTRACKSPEREVENT]
 
int istampa
 
TH1F * hdist
 
TH1F * hdistgoodlast
 
TH1F * hdistbadlast
 
FILE * HANDLE
 
FILE * HANDLE2
 
FILE * HANDLEXYZ
 
FILE * PHANDLEX
 
FILE * PHANDLEY
 
FILE * PHANDLEZ
 
FILE * SHANDLEX
 
FILE * SHANDLEY
 
FILE * SHANDLEZ
 
Double_t veritaMC [nmaxHits][3]
 
Short_t MINIMUMHITSPERTRACK
 
Short_t MINIMUMOUTERHITSPERTRACK
 
Short_t nRdivConformalEffective
 
Short_t nSciTilHits
 
Short_t nSttSkewhit
 
Short_t infoparal [nmaxHits]
 
Short_t infoskew [nmaxHits]
 
Short_t nHitsInMCTrack [MAXTRACKSPEREVENT]
 
Short_t nSciTilHitsinTrack [MAXTRACKSPEREVENT]
 
Short_t nSttSkewhitInMCTrack [MAXTRACKSPEREVENT]
 
Short_t ListSciTilHitsinTrack [MAXTRACKSPEREVENT][nmaxSciTilHitsinTrack]
 
Short_t nMCTracks
 
Double_t Fimin
 
Double_t Fimax
 
Double_t FI0min
 
Double_t FI0max
 
Double_t stepD
 
Double_t stepFi
 
Double_t stepR
 
Double_t stepKAPPA
 
Double_t stepFI0
 
Double_t stepfineKAPPA
 
Double_t stepfineFI0
 
Double_t SEMILENGTH_STRAIGHT
 
Double_t ZCENTER_STRAIGHT
 
Double_t ALFA [MAXTRACKSPEREVENT]
 
Double_t BETA [MAXTRACKSPEREVENT]
 
Double_t GAMMA [MAXTRACKSPEREVENT]
 
Double_t radiaConf [nRdivConformal]
 
Double_t CxMC [MAXTRACKSPEREVENT]
 
Double_t CyMC [MAXTRACKSPEREVENT]
 
Double_t R_MC [MAXTRACKSPEREVENT]
 
Double_t posizSciTil [nmaxSciTilHits][3]
 
Double_t S_SciTilHitsinTrack [MAXTRACKSPEREVENT][nmaxSciTilHits]
 
TClonesArray * fMCTrackArray
 
TClonesArray * fSciTPointArray
 
TClonesArray * fSciTHitArray
 
TClonesArray * fTubeArray
 
PndMCTrackpMCtr
 
TList fHitCollectionList
 
TList fPointCollectionList
 
TClonesArray * fSttHitArray
 
char fSttBranch [100]
 

Static Private Attributes

static const Short_t nmaxHits = 1000
 
static const Short_t nmaxHitsInTrack =60
 
static const Short_t nmaxSciTilHits = 200
 
static const Short_t nmaxSciTilHitsinTrack = 2
 
static const Short_t MAXMCTRACKS =10000
 
static const Short_t MAXTRACKSPEREVENT =50
 
static const Short_t MAXHITSINCELL =50
 
static const Short_t nmaxinclinationversors =20
 
static const Short_t nAdmittedRadia = 3
 
static const Short_t nbinCX =100
 
static const Short_t nbinCY = 100
 
static const Short_t nbinZ = 100
 
static const Short_t nbinR = 100
 
static const Short_t nbinD = 250
 
static const Short_t nbinFi = 250
 
static const Short_t nbinKAPPA = 200
 
static const Short_t nbinFI0 = 200
 
static const Short_t MINIMUMCOUNTSDFiR = 18
 
static const Short_t MINIMUMCOUNTSKAPPAFI0 = 5
 
static const Short_t MAXElementsOverThresholdinHough = 500
 
static const Short_t nRdivConformal =10
 
static const Short_t NHITSINFIT =15
 
static const Short_t DELTAnR = 2
 
static const Double_t PI = 3.141592654
 
static const Double_t RStrawDetectorMin = 16.119
 
static const Double_t ApotemaMaxInnerParStraw = 23.246827
 
static const Double_t ApotemaMinSkewStraw = 23.246827
 
static const Double_t ApotemaMaxSkewStraw = 31.517569
 
static const Double_t ApotemaMinOuterParStraw = 31.863369
 
static const Double_t RStrawDetectorMax = 40.73
 
static const Double_t VERTICALGAP = 4.
 
static const Double_t Rmin =20.
 
static const Double_t Rmax =700.
 
static const Double_t PMAX =100.
 
static const Double_t STRAWRADIUS = 0.5
 
static const Double_t StrawDriftError = 0.02
 
static const Double_t SKEWinclination_DEGREES = 3.
 
static const Double_t CXmin =-150.
 
static const Double_t CXmax =150.
 
static const Double_t CYmin =-300.
 
static const Double_t CYmax =300.
 
static const Double_t Dmin =-21.
 
static const Double_t Dmax =21.
 
static const Double_t KAPPAmin =-2.
 
static const Double_t KAPPAmax = 2.
 
static const Double_t Zmin = -75.
 
static const Double_t Zmax = 75.
 
static const Double_t DELTA_R =5.
 
static const Double_t DELTA_Fi =0.3
 
static const Double_t DELTA_D =2.
 
static const Double_t DELTA_KAPPA =0.03
 
static const Double_t DELTA_FI0 = 0.3
 
static const Double_t RMAXSCITIL = 50.
 
static const Double_t DIMENSIONSCITIL =2.85
 
static const Double_t BFIELD =2.
 
static const Double_t CVEL = 2.99792
 
static const bool YesClean = false
 
static const Short_t nFidivConformal = (Short_t) (3.141592654 * 45./0.5)
 
static const int nmassimo =50
 
static const int TIMEOUT =60
 

Detailed Description

Definition at line 37 of file PndSttTrackFinderReal.h.

Constructor & Destructor Documentation

PndSttTrackFinderReal::PndSttTrackFinderReal ( )

Default constructor

Definition at line 43 of file PndSttTrackFinderReal.cxx.

References DELTA_FI0, DELTA_KAPPA, Dmax, Dmin, doMcComparison, FI0max, FI0min, Fimax, Fimin, fSttBranch, Initialization_ClassVariables(), iplotta, istampa, KAPPAmax, KAPPAmin, MINIMUMOUTERHITSPERTRACK, nbinD, nbinFi, nbinFI0, nbinKAPPA, nbinR, nSciTilHits, PI, Rmax, Rmin, stepD, stepFi, stepFI0, stepfineFI0, stepfineKAPPA, stepKAPPA, stepR, and YesSciTil.

44 {
45  doMcComparison = false;
46  Fimin=0.; Fimax=2.*PI;
47  FI0min = 0.; FI0max = 2.*PI;
48  iplotta = false;
49  istampa = 0;
51  nSciTilHits=0;
52  stepD=(Dmax-Dmin)/nbinD;
54  stepR=(Rmax-Rmin)/nbinR;
59  YesSciTil = false ;
60 
62  sprintf(fSttBranch,"STTHit");
63 
64 }
static const Double_t KAPPAmax
static const Double_t DELTA_FI0
static const Double_t KAPPAmin
static const Short_t nbinFi
static const Double_t DELTA_KAPPA
static const Double_t Dmax
static const Short_t nbinR
static const Double_t Dmin
static const Short_t nbinD
static const Double_t Rmin
static const Double_t Rmax
static const Double_t PI
static const Short_t nbinKAPPA
static const Short_t nbinFI0
PndSttTrackFinderReal::PndSttTrackFinderReal ( Int_t  verbose)

Standard constructor

PndSttTrackFinderReal::PndSttTrackFinderReal ( int  istamp,
bool  iplot,
bool  doMcComparison 
)

Second constructor

Definition at line 96 of file PndSttTrackFinderReal.cxx.

References DELTA_FI0, DELTA_KAPPA, Dmax, Dmin, doMcComparison, FI0max, FI0min, Fimax, Fimin, fSttBranch, Initialization_ClassVariables(), iplotta, istampa, KAPPAmax, KAPPAmin, MINIMUMOUTERHITSPERTRACK, nbinD, nbinFi, nbinFI0, nbinKAPPA, nbinR, nSciTilHits, PI, Rmax, Rmin, stepD, stepFi, stepFI0, stepfineFI0, stepfineKAPPA, stepKAPPA, stepR, and YesSciTil.

97 {
98  doMcComparison = imc;
99  Fimin=0.; Fimax=2.*PI;
100  FI0min = 0.; FI0max = 2.*PI;
101  iplotta = iplott;
102  istampa= istamp;
104  nSciTilHits=0;
105  stepD=(Dmax-Dmin)/nbinD;
107  stepR=(Rmax-Rmin)/nbinR;
112  YesSciTil = false ;
114  sprintf(fSttBranch,"STTHit");
115 }
static const Double_t KAPPAmax
static const Double_t DELTA_FI0
static const Double_t KAPPAmin
static const Short_t nbinFi
static const Double_t DELTA_KAPPA
static const Double_t Dmax
static const Short_t nbinR
static const Double_t Dmin
static const Short_t nbinD
static const Double_t Rmin
static const Double_t Rmax
static const Double_t PI
static const Short_t nbinKAPPA
static const Short_t nbinFI0
PndSttTrackFinderReal::PndSttTrackFinderReal ( int  istamp,
bool  iplot,
bool  doMcComparison,
bool  doSciTil 
)

Third constructor

Definition at line 121 of file PndSttTrackFinderReal.cxx.

References DELTA_FI0, DELTA_KAPPA, Dmax, Dmin, doMcComparison, FI0max, FI0min, Fimax, Fimin, fSttBranch, Initialization_ClassVariables(), iplotta, istampa, KAPPAmax, KAPPAmin, MINIMUMOUTERHITSPERTRACK, nbinD, nbinFi, nbinFI0, nbinKAPPA, nbinR, nSciTilHits, PI, Rmax, Rmin, stepD, stepFi, stepFI0, stepfineFI0, stepfineKAPPA, stepKAPPA, stepR, and YesSciTil.

122 {
123 
124  doMcComparison = imc;
125  Fimin=0.; Fimax=2.*PI;
126  FI0min = 0.; FI0max = 2.*PI;
127  iplotta = iplott;
128  istampa= istamp;
130  nSciTilHits=0;
131  stepD=(Dmax-Dmin)/nbinD;
133  stepR=(Rmax-Rmin)/nbinR;
138  YesSciTil = doSciTil ;
140  sprintf(fSttBranch,"STTHit");
141 }
static const Double_t KAPPAmax
static const Double_t DELTA_FI0
static const Double_t KAPPAmin
static const Short_t nbinFi
static const Double_t DELTA_KAPPA
static const Double_t Dmax
static const Short_t nbinR
static const Double_t Dmin
static const Short_t nbinD
static const Double_t Rmin
static const Double_t Rmax
static const Double_t PI
static const Short_t nbinKAPPA
static const Short_t nbinFI0
PndSttTrackFinderReal::~PndSttTrackFinderReal ( )
virtual

Destructor

Definition at line 147 of file PndSttTrackFinderReal.cxx.

148 {
149 }

Member Function Documentation

virtual void PndSttTrackFinderReal::AddHitCollection ( TClonesArray *  mHitArray,
TClonesArray *  mPointArray 
)
inlinevirtual

Implements PndSttTrackFinder.

Definition at line 71 of file PndSttTrackFinderReal.h.

References fHitCollectionList, and fPointCollectionList.

72  {fHitCollectionList.Add(mHitArray); fPointCollectionList.Add(mPointArray);};
Short_t PndSttTrackFinderReal::AssociateBetterAfterFitSkewHitsToXYTrack ( Short_t  TemporarynSttSkewhitinTrack,
Short_t  SkewList[nmaxHits][2],
Double_t S,
Double_t Z,
Double_t ZDrift,
Double_t ZRadiusafterTilt,
Double_t  KAPPA,
Double_t  FI0,
Short_t *  tempore,
Double_t temporeS,
Double_t temporeZ,
Double_t temporeZDrift,
Double_t temporeZErrorafterTilt,
Int_t *  STATUS 
)
private

Definition at line 7075 of file PndSttTrackFinderReal.cxx.

References Double_t, fabs(), i, PI, sign(), sin(), SKEWinclination_DEGREES, and STRAWRADIUS.

Referenced by DoFind().

7091  {
7092 
7093 
7094 
7095  Short_t NAssociated;
7096  Short_t sign;
7097  Int_t i, j, i1, ii, iii, Kincl, nlow, nup;
7098 
7099  Double_t bbb,
7100  tempZ[2],
7101  zmin, zmax, deltaz,
7102  zdist[2],
7103  zdist1,
7104  zdist2;
7105 
7106  Double_t allowed_distance = 4.*STRAWRADIUS/sin(SKEWinclination_DEGREES*PI/180.);
7107 
7108 
7109  if(fabs(KAPPA)<1.e-20) {
7110  *STATUS=-1;
7111  return 0;
7112  }
7113 
7114 
7115  NAssociated=0;
7116 
7117  if(KAPPA>0) {
7118  zmin = -FI0/KAPPA;
7119  zmax = (2.*PI-FI0)/KAPPA;
7120  } else {
7121  zmax = -FI0/KAPPA;
7122  zmin = (2.*PI-FI0)/KAPPA;
7123  }
7124  deltaz = zmax-zmin;
7125 
7126  for(i=0; i<TemporarynSttSkewhitinTrack; i++){
7127  bbb=(S[i]-FI0)/KAPPA;
7128  for(sign=0;sign<=1; sign ++){
7129  tempZ[sign]=Z[i]+(2*sign-1)*ZDrift[i];
7130  if( tempZ[sign] > zmax ){
7131  tempZ[sign]=fmod( tempZ[sign]-zmax, deltaz) + zmin;
7132  } else if (tempZ[sign]<zmin){
7133  tempZ[sign]=fmod( tempZ[sign]-zmin, deltaz) + zmax;
7134  }
7135 
7136  zdist1 = fabs( bbb - tempZ[sign]);
7137  zdist2 = deltaz- zdist1;
7138  if(zdist2<0.) zdist2 = 0.; // protect against rounding errors.
7139  zdist[sign] = zdist1 < zdist2 ? zdist1 : zdist2;
7140  } // end of for(sign=0;sign<=1; sign++)
7141 
7142 
7143  zdist1 = zdist[0] < zdist[1] ? zdist[0] : zdist[1];
7144 
7145 
7146  if( zdist1 < allowed_distance ){
7147 
7148 // if( zdist < 4.*ZErrorafterTilt[i] ){
7149 
7150  tempore[NAssociated]=SkewList[ i ][0];
7151  temporeS[NAssociated]=S[i];
7152  temporeZ[NAssociated]=Z[i];
7153  temporeZDrift[NAssociated]=ZDrift[i];
7154  temporeZErrorafterTilt[NAssociated]=ZErrorafterTilt[i];
7155  NAssociated++;
7156  }
7157 
7158 
7159  } // end of for(i=0; i<TemporarynSttSkewhitinTrack; i++)
7160 
7161 
7162  *STATUS=0;
7163 
7164  return NAssociated;
7165 
7166 
7167 
7168  }
Int_t i
Definition: run_full.C:25
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
static const Double_t SKEWinclination_DEGREES
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Double_t PI
static const Double_t STRAWRADIUS
double Z
Definition: anaLmdDigi.C:68
int sign(T val)
Definition: PndCADef.h:48
void PndSttTrackFinderReal::AssociateFoundTrackstoMC ( Double_t  info[][7],
Short_t  nTracksFoundSoFar,
Short_t *  nHitsinTrack,
Short_t  ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHits],
Short_t *  nSttSkewhitinTrack,
Short_t  ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHits],
Short_t  daTrackFoundaTrackMC[MAXTRACKSPEREVENT] 
)
private

Definition at line 10659 of file PndSttTrackFinderReal.cxx.

References i, infoparal, infoskew, and nmaxHits.

10669 {
10670 
10671  bool firstime,
10672  flaggo,
10673  inclusionMC[nTracksFoundSoFar][nmaxHits],
10674  inclusionExp[nTracksFoundSoFar];
10675 
10676  Short_t ntoMCtrack[nTracksFoundSoFar],
10677  toMCtracklist[nTracksFoundSoFar][nmaxHits],
10678  toMCtrackfrequency[nTracksFoundSoFar][nmaxHits];
10679 
10680  Short_t i, j, jtemp,jexp;
10681 
10682  Short_t enne,
10683  itemp,
10684  massimo;
10685 
10686 
10687 
10688  for(i=0; i<nTracksFoundSoFar;i++){
10689  daTrackFoundaTrackMC[i]=-1;
10690  inclusionExp[i]=true;
10691  for(j=0; j<nHitsinTrack[i]+nSttSkewhitinTrack[i];j++){
10692  inclusionMC[i][j]=true;
10693  }
10694  }
10695 
10696 
10697 
10698 
10699 
10700 
10701  for(jexp=0; jexp< nTracksFoundSoFar ;jexp++){
10702 
10703  firstime=true;
10704  ntoMCtrack[jexp]=0;
10705 
10706 // prima gli hits paralleli ---------------------
10707 
10708  for(i=0; i<nHitsinTrack[jexp]; i++){
10709  enne = (Short_t)( info[ infoparal[ ListHitsinTrack[jexp][i] ] ][6]+0.01 );
10710  if(enne<0) continue; // hit not associated to any MC track; noise hit.
10711  if(firstime) {
10712  ntoMCtrack[jexp]=1;
10713  toMCtracklist[jexp][0]= enne;
10714  toMCtrackfrequency[jexp][0]=1;
10715  firstime = false;
10716  } else {
10717 
10718  flaggo=true;
10719  for(j=0; j<ntoMCtrack[jexp]; j++){
10720  if( enne == toMCtracklist[jexp][j] ) {
10721  toMCtrackfrequency[jexp][j]++;
10722  flaggo=false;
10723  break;
10724  }
10725  }
10726  if(flaggo){
10727  toMCtracklist[jexp][ ntoMCtrack[jexp] ] = enne;
10728  toMCtrackfrequency[jexp][ ntoMCtrack[jexp] ] = 1;
10729  ntoMCtrack[jexp]++;
10730  }
10731  }
10732 
10733  } // end of for(i=0; i<nHitsinTrack[jexp]; i++)
10734 
10735 
10736 
10737 // poi gli hits skew ---------------------
10738  for(i=0; i<nSttSkewhitinTrack[jexp]; i++){
10739  enne = (Short_t)( info[ infoskew[ ListSkewHitsinTrack[jexp][i] ] ][6]+0.01 );
10740  if(enne<0) continue; // hit not associated to any MC track; noise hit.
10741  if(firstime) {
10742  ntoMCtrack[jexp]=1;
10743  toMCtracklist[jexp][0]= enne;
10744  toMCtrackfrequency[jexp][0]=1;
10745  firstime = false;
10746  } else {
10747  for(j=0, flaggo=true; j<ntoMCtrack[jexp]; j++){
10748  if( enne == toMCtracklist[jexp][j] ) {
10749  toMCtrackfrequency[jexp][j]++;
10750  flaggo=false ;
10751  break;
10752  }
10753  }
10754  if(flaggo){
10755  toMCtracklist[jexp][ ntoMCtrack[jexp] ] = enne;
10756  toMCtrackfrequency[jexp][ ntoMCtrack[jexp] ] = 1;
10757  ntoMCtrack[jexp]++;
10758  }
10759  }
10760  } // end of for(i=0; j<nHitsinTrack[jexp]; i++)
10761 
10762 
10763 
10764  } // end of for(jexp=0; jexp< nTracksFoundSoFar ;jexp++)
10765 
10766 
10767  itemp=0;
10768  while ( itemp > -1){
10769  itemp=-1;
10770  massimo = -1;
10771  for(jexp=0; jexp< nTracksFoundSoFar ;jexp++){
10772  if( !inclusionExp[jexp]) continue;
10773  for(i=0; i< ntoMCtrack[jexp]; i++){
10774  if( !inclusionMC[jexp][i]) continue;
10775  if( toMCtrackfrequency[jexp][i]>massimo){
10776  massimo=toMCtrackfrequency[jexp][i];
10777  itemp = toMCtracklist[jexp][i];
10778  jtemp = jexp;
10779  }
10780  }
10781  }
10782  if( itemp>-1 ){
10783  daTrackFoundaTrackMC[jtemp]=itemp;
10784  inclusionExp[jtemp]=false;
10785  inclusionMC[jtemp][itemp]=false;
10786  }
10787  } // end while ( itemp > -1)
10788 
10789 
10790 
10791 
10792 
10793 
10794  return;
10795 }
Int_t i
Definition: run_full.C:25
static const Short_t nmaxHits
void PndSttTrackFinderReal::AssociateFoundTrackstoMCbis ( bool *  keepit,
Double_t  info[][7],
Short_t  nTracksFoundSoFar,
Short_t  nHitsinTrack[MAXTRACKSPEREVENT],
Short_t  ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
Short_t  nSttSkewhitinTrack[MAXTRACKSPEREVENT],
Short_t  ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
Short_t  daTrackFoundaTrackMC[MAXTRACKSPEREVENT] 
)
private

Definition at line 10817 of file PndSttTrackFinderReal.cxx.

References i, infoparal, and nmaxHits.

Referenced by DoFind().

10827 {
10828 
10829  bool firstime,
10830  flaggo,
10831  inclusionMC[nTracksFoundSoFar][nmaxHits],
10832  inclusionExp[nTracksFoundSoFar];
10833 
10834  Short_t ntoMCtrack[nTracksFoundSoFar],
10835  toMCtrackfrequency[nTracksFoundSoFar][nmaxHits];
10836 
10837  Short_t i, j, jtemp,jexp;
10838 
10839  Short_t enne,
10840  itemp,
10841  massimo,
10842  toMCtracklist[nTracksFoundSoFar][nmaxHits];
10843 
10844 
10845 
10846  for(i=0; i<nTracksFoundSoFar;i++){
10847 // daTrackFoundaTrackMC[i]=-1; // initialization already done before!
10848  if(!keepit[i]){
10849  inclusionExp[i]=false;
10850  continue;
10851  }
10852  inclusionExp[i]=true;
10853  for(j=0; j<nHitsinTrack[i]+nSttSkewhitinTrack[i];j++){
10854  inclusionMC[i][j]=true;
10855  }
10856  }
10857 
10858 
10859 
10860  for(jexp=0; jexp< nTracksFoundSoFar ;jexp++){
10861 
10862  if(!keepit[jexp]) continue;
10863  firstime=true;
10864  ntoMCtrack[jexp]=0;
10865 
10866 
10867 // ------ only the parallel hits are taken into consideration
10868  for(i=0; i<nHitsinTrack[jexp]; i++){
10869 
10870  enne = (Short_t)( info[ infoparal[ ListHitsinTrack[jexp][i] ] ][6]+0.01 );
10871  if(enne<0) continue; // hit not associated to any MC track; noise hit.
10872  if(firstime) {
10873  ntoMCtrack[jexp]=1;
10874  toMCtracklist[jexp][0]= enne;
10875  toMCtrackfrequency[jexp][0]=1;
10876  firstime = false;
10877  } else {
10878  for(j=0, flaggo=true; j<ntoMCtrack[jexp]; j++){
10879  if( enne == toMCtracklist[jexp][j] ) {
10880  toMCtrackfrequency[jexp][j]++;
10881  flaggo=false ;
10882  break;
10883  }
10884  }
10885  if(flaggo){
10886  toMCtracklist[jexp][ ntoMCtrack[jexp] ] = enne;
10887  toMCtrackfrequency[jexp][ ntoMCtrack[jexp] ] = 1;
10888  ntoMCtrack[jexp]++;
10889  }
10890  }
10891  } // end of for(i=0; i<nHitsinTrack[jexp]; i++)
10892 
10893 
10894 
10895  } // end of for(jexp=0; jexp< nTracksFoundSoFar ;jexp++)
10896 
10897 
10898  itemp=0;
10899  while ( itemp > -1){
10900  itemp=-1;
10901  massimo = -1;
10902  for(jexp=0; jexp< nTracksFoundSoFar ;jexp++){
10903  if( !inclusionExp[jexp]) continue;
10904  for(i=0; i< ntoMCtrack[jexp]; i++){
10905  if( !inclusionMC[jexp][i]) continue;
10906  if( toMCtrackfrequency[jexp][i]>massimo){
10907  massimo=toMCtrackfrequency[jexp][i];
10908  itemp = toMCtracklist[jexp][i];
10909  jtemp = jexp;
10910  }
10911  }
10912  }
10913  if( itemp>-1 ){
10914  daTrackFoundaTrackMC[jtemp]=itemp;
10915  inclusionExp[jtemp]=false;
10916  for(jexp=0; jexp<nTracksFoundSoFar;jexp++){
10917  if( !inclusionExp[jexp]) continue;
10918  for(int jk=0;jk<ntoMCtrack[jexp];jk++){
10919  if( itemp==toMCtracklist[jexp][jk]){
10920  inclusionMC[jexp][jk]=false;
10921  }
10922  }
10923  }
10924  }
10925  } // end while ( itemp > -1)
10926 
10927  return;
10928 
10929 
10930 }
Int_t i
Definition: run_full.C:25
static const Short_t nmaxHits
Short_t PndSttTrackFinderReal::AssociateSciTilHit ( Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Short_t *  List,
Double_t esse 
)
private

Definition at line 13655 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, InclusionListSciTil, IntersectionSciTil_Circle(), CAMath::Nint(), nmaxSciTilHitsinTrack, nSciTilHits, PI, and posizSciTil.

Referenced by FindTrackInXYProjection().

13662 {
13663 
13664  bool intersect;
13665 
13666  Short_t
13667  igoodScit,
13668  iScitHit,
13669  Nint;
13670 
13671  Double_t
13672  distance,
13673  QQ,
13674  sqrtRR,
13675  SIGN,
13676  XintersectionList[2],
13677  YintersectionList[2];
13678 
13679 
13680  igoodScit=0;
13681  for(iScitHit=0; iScitHit<nSciTilHits; iScitHit++){
13682  if(!InclusionListSciTil[iScitHit]) continue;
13683 
13684  intersect=IntersectionSciTil_Circle(
13685  posizSciTil[iScitHit][0],
13686  posizSciTil[iScitHit][1],
13687  Oxx,
13688  Oyy,
13689  Rr,
13690  &Nint, // output
13691  XintersectionList, // output
13692  YintersectionList // output
13693  );
13694 
13695  if(intersect){
13696  List[igoodScit] = iScitHit;
13697 
13698  // calculate S on the lateral face of the Helix.
13699  if ( Nint==1){ // the majority of the cases
13700  esse[igoodScit] = atan2(YintersectionList[0]-Oyy,
13701  XintersectionList[0]-Oxx);
13702  } else { // in this case Nint=2 (it should be a very rare case).
13703  // do an average of the two positions.
13704  esse[igoodScit] = atan2( 0.5*(YintersectionList[0]+
13705  YintersectionList[1])-Oyy,
13706  0.5*(XintersectionList[0]+
13707  XintersectionList[1])-Oxx);
13708  } // end of if ( Nint==1)
13709  if ( esse[igoodScit]<0.) esse[igoodScit] += 2.*PI;
13710  igoodScit++;
13711  if( igoodScit == nmaxSciTilHitsinTrack) break;
13712 
13713  } // end of if(intersect && distance<olddist)
13714  } // end of for(iScitHit=0; iScitHit<nScitHits; iScitHit++)
13715 
13716  return igoodScit;
13717 
13718 }
Double_t posizSciTil[nmaxSciTilHits][3]
Double_t
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])
static const Double_t PI
bool InclusionListSciTil[nmaxSciTilHits]
static const Short_t nmaxSciTilHitsinTrack
int Nint(float x)
Definition: PndCAMath.h:117
Short_t PndSttTrackFinderReal::AssociateSkewHitsToXYTrack ( bool *  ExclusionListSkew,
Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  info[][7],
Double_t  inclination[][3],
Double_t  Fi_low_limit,
Double_t  Fi_up_limit,
Short_t  Charge,
Double_t  Fi_initial_helix_referenceframe,
Double_t  Fi_final_helix_referenceframe,
Short_t  SkewList[nmaxHits][2],
Double_t S,
Double_t Z,
Double_t ZDrift,
Double_t ZRadiusafterTilt 
)
private

Definition at line 6866 of file PndSttTrackFinderReal.cxx.

References angle, atan2(), calculateintersections(), ccc, Double_t, dx, dy, fabs(), i, infoskew, nSttSkewhit, offset(), PI, R, SEMILENGTH_STRAIGHT, sqrt(), StrawDriftError, xmax, xmin, ZCENTER_STRAIGHT, and zpos.

Referenced by DoFind().

6884  {
6885 
6886 
6887 
6888  Int_t i, j, i1, ii, iii, NAssociated, Kincl, nlow, nup, STATUS, Nmin, Nmax;
6889 
6890  Double_t xmin , xmax, ymin, ymax,
6891  dx, dy, diff, d1, d2,
6892  delta, deltax, deltay, deltaz, deltaS,
6893  factor,
6894  zmin, zmax, Smin, Smax, S1, S2,
6895  z1, z2, y1, y2,
6896  vx1, vy1, vz1, C0x1, C0y1, C0z1,
6897  aaa, bbb, ccc, angle, minor, major,
6898  distance, Rx, Ry, LL,
6899  Aellipsis1, Bellipsis1,fi1,
6900  fmin, fmax, offset, step,
6901  SkewInclWithRespectToS, zpos, zpos1, zpos2,
6902  Tiltdirection1[2],
6903  zl[200],zu[200],
6904  POINTS1[6];
6905 
6906 
6907 // calculate the Fi range allowed to the skew hits, with Fi calculated in the TRACK CYLINDER REFERENCE FRAME.
6908 
6909 // Smin=zmin = 1.e10;
6910 // Smax=zmax = -zmin;
6911  NAssociated=0;
6912 
6913  for( iii=0; iii< nSttSkewhit; iii++) {
6914  i = infoskew[iii];
6915  if( !InclusionListSkew[i]) continue;
6916 
6917 
6918  Kincl = (int) info[i][5] - 1;
6919 
6920 
6921  aaa = sqrt(inclination[Kincl][0]*inclination[Kincl][0]+inclination[Kincl][1]*inclination[Kincl][1]+
6922  inclination[Kincl][2]*inclination[Kincl][2]);
6923  vx1 = inclination[Kincl][0]/aaa;
6924  vy1 = inclination[Kincl][1]/aaa;
6925  vz1 = inclination[Kincl][2]/aaa;
6926  C0x1 = info[i][0];
6927  C0y1 = info[i][1];
6928  C0z1 = info[i][2];
6929 
6930  calculateintersections(Ox,Oy,R,C0x1,C0y1,C0z1,info[i][3],
6931  vx1,vy1,vz1,
6932  &STATUS,POINTS1);
6933 
6934  if(STATUS < 0 ) continue ;
6935 
6936 
6937  for( ii=0; ii<2; ii++){
6938 
6939  j=3*ii;
6940  distance = sqrt(
6941  (POINTS1[j]-C0x1)*(POINTS1[j]-C0x1) +
6942  (POINTS1[1+j]-C0y1)*(POINTS1[1+j]-C0y1) +
6943  (POINTS1[2+j]-C0z1)*(POINTS1[2+j]-C0z1)
6944  );
6945 
6946 
6947  Rx = POINTS1[j]-Ox ; // x component Radial vector of cylinder of trajectory
6948  Ry = POINTS1[1+j]-Oy ; // y direction Radial vector of cylinder of trajectory
6949 
6950  aaa = sqrt(Rx*Rx+Ry*Ry);
6951  SkewInclWithRespectToS = (-Ry*vx1 + Rx*vy1)/aaa ;
6952  SkewInclWithRespectToS /= R;
6953  bbb = sqrt( SkewInclWithRespectToS*SkewInclWithRespectToS + vz1*vz1);
6954  // the tilt direction of this ellipse is (1,0) when major axis along Z direction
6955  if( bbb > 1.e-10){
6956  Tiltdirection1[0] = vz1/bbb;
6957  Tiltdirection1[1] = SkewInclWithRespectToS/bbb;
6958  } else {
6959  Tiltdirection1[0] = 1.;
6960  Tiltdirection1[1] = 0.;
6961  }
6962 
6963  LL = fabs(vx1*Rx + vy1*Ry);
6964  if( LL < 1.e-10) continue;
6965 
6966  Aellipsis1 = info[i][3]*aaa/LL;
6967 
6968  Bellipsis1 = info[i][3]/R;
6969 
6970  if( distance >= info[i][4] + Aellipsis1 ) continue;
6971 
6972 // checks that the projected ellipsis doesn't go out the boundaries of both the skew straw and the trajectory cylinder
6973 
6974 // if(
6975 // fabs(POINTS1[j+2]-info[i][2]) > SEMILENGTH_STRAIGHT- Aellipsis1 ||
6976 // distance + bbb > info[i][4] // the ellipsis goes out of the boundaries of the skew straw
6977 // ) {
6978 // if( istampa) cout<<"the ellipsis goes out of the boundaries of the skew straw, hit n. "<<i<<endl
6979 // <<"dis. from center "<<distance+bbb<<", length of the straw "<<info[i][4]<<endl;
6980 // continue;
6981 // }
6982 //--------------------------
6983 
6984 
6985  S[NAssociated] = atan2(POINTS1[j+1]-Oy, POINTS1[j]-Ox) ; // atan2 returns radians in (-pi and +pi]
6986  if( S[NAssociated] < 0.) S[NAssociated] += 2.*PI;
6987 
6988 // check if the S of this intersection is compatible with information coming from the parallel fit of this track
6989 // Double_t Sprime = atan2(POINTS1[j+1], POINTS1[j]) ;
6990 // if( Sprime < 0.) Sprime += 2.*PI;
6991 
6992 // if( Sprime < Fi_low_limit) {
6993 // if( Sprime+2.*PI > Fi_up_limit) continue;
6994 // } else {
6995 // if( Sprime > Fi_up_limit) continue;
6996 // }
6997 
6998 
6999  if( S[NAssociated] < Fi_low_limit) {
7000  if( S[NAssociated]+2.*PI > Fi_up_limit) continue;
7001  } else if( S[NAssociated] > Fi_up_limit) {
7002  if( S[NAssociated]- 2.*PI < Fi_low_limit) continue;
7003  }
7004 
7005 
7006 
7007 // second check, to see if this hits are in the allowed Fi range in the Helix reference frame
7008 /*
7009  if ( S[NAssociated] < Fi_allowedforskew_low) {
7010  if (S[NAssociated] + 2.*PI > Fi_allowedforskew_up) continue;
7011  } else {
7012  if (S[NAssociated] > Fi_allowedforskew_up) continue;
7013  }
7014 */
7015 
7016 //--------------------------- end check
7017 
7018 
7019  Z[NAssociated] = POINTS1[j+2];
7020  ZDrift[NAssociated] = Aellipsis1*Tiltdirection1[0];
7021  ZErrorafterTilt[NAssociated] = StrawDriftError*aaa*Tiltdirection1[0]/LL;
7022  SkewList[NAssociated][0] = iii; // n. skew hit in skew hit numbering
7023  SkewList[NAssociated][1] = ii; // solution 0 or solution 1 were accepted
7024 
7025 
7026 // check if this skew hit doesn't "push out" the most external parallel hit
7027 // (see Gianluigi's logbook on page 251)
7028 
7029  Double_t Zh1 = Z[NAssociated] - ZDrift[NAssociated];
7030  Double_t Zh2 = Z[NAssociated] + ZDrift[NAssociated];
7031  Double_t Sh1 = S[NAssociated] - Aellipsis1*Tiltdirection1[1];
7032  Double_t Sh2 = S[NAssociated] + Aellipsis1*Tiltdirection1[1];
7033  Double_t Zlast1 = (Fi_final_helix_referenceframe-Fi_initial_helix_referenceframe)*Zh1
7034  /(Sh1-Fi_initial_helix_referenceframe);
7035  Double_t Zlast2 = (Fi_final_helix_referenceframe-Fi_initial_helix_referenceframe)*Zh2
7036  /(Sh2-Fi_initial_helix_referenceframe);
7037 
7038 
7039 
7040 
7041  if( fabs(Zlast1 - ZCENTER_STRAIGHT) > SEMILENGTH_STRAIGHT
7042  &&
7044  ) continue;
7045 
7046 
7047  NAssociated++;
7048 
7049  } // end of for( ii=0; ii<2; ii++)
7050 
7051  } // for( iii=0; iii< nSttSkewhit; iii++)
7052 
7053 
7054 
7055  return NAssociated;
7056 
7057 
7058 
7059  }
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t xmax
static const Double_t StrawDriftError
TVector3 offset(2, 0, 0)
void calculateintersections(Double_t Ox, Double_t Oy, Double_t R, 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)
Double_t
const Double_t zpos
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
static const Double_t PI
double Z
Definition: anaLmdDigi.C:68
Double_t xmin
Double_t angle
Double_t R
Definition: checkhelixhit.C:61
bool PndSttTrackFinderReal::BadTrack_ParStt ( Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Short_t  Charge,
Double_t  Xcross[2],
Double_t  Ycross[2],
Short_t  nHits,
Short_t *  ListHits,
Double_t  info[][7],
Double_t  cut,
Short_t  maxnum,
Short_t  islack 
)
private
Double_t PndSttTrackFinderReal::CalculateArcLength ( Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Short_t  Charge,
Double_t  Xcross[2],
Double_t  Ycross[2] 
)
private

Definition at line 12906 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, and PI.

12914 {
12915  Double_t dis,
12916  theta1,
12917  theta2;
12918 
12919  theta1 = atan2(Ycross[0]-Oyy, Xcross[0]- Oxx);
12920  theta2 = atan2(Ycross[1]-Oyy, Xcross[1]- Oxx);
12921 
12922 
12923  if(charge>0){ // the rotation was clockwise.
12924  dis = theta1-theta2;
12925  } else { // the rotation was counterclockwise.
12926  dis = theta2-theta1;
12927  }
12928 
12929  if(dis<0.) dis += 2.*PI;
12930  if(dis<0.) dis =0.;
12931 
12932  dis *= Rr;
12933 
12934  return dis;
12935 }
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void PndSttTrackFinderReal::calculateintersections ( Double_t  Ox,
Double_t  Oy,
Double_t  R,
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 
)
private

Definition at line 2756 of file PndSttTrackFinderReal.cxx.

References Double_t, and sqrt().

Referenced by AssociateSkewHitsToXYTrack(), WriteMacroSkewAssociatedHits(), WriteMacroSkewAssociatedHitswithMC(), and WriteMacroSkewAssociatedHitswithRfromMC().

2759 {
2760 
2761 
2762 //-------------------------------------------
2763 
2764 
2765  Double_t P1x, P1y, P1z, P2x, P2y, P2z;
2766 
2767  Double_t AAA, DELTA, ax, ay, aaa;
2768 
2769 
2770 
2771 
2772 /*
2773  INPUTS :
2774 
2775  Ox, Oy = abscissa and ordinate of the center of the circular trajectory of
2776  the particle;
2777  R = radius of such trajectory;
2778  C0x, C0y, Coz = x, y, z coordinates of a point belonging to the axis of the
2779  skewed straw;
2780  r = radius of equidrift of such skewed straw;
2781  vx, vy, vz = versor of the direction along which the skewed straw lies.
2782 
2783 
2784  OUTPUTS :
2785 
2786  P1x, P1y, P1z = x, y, z coordinates of the point intersection between the
2787  particle trajectory circle and the equidrift cylinder of
2788  the skewed straw calculated as a function of theta (first
2789  solution);
2790  P2x, P2y, P2z = x, y, z coordinates of the point intersection between the
2791  particle trajectory circle and the equidrift cylinder of
2792  the skewed straw calculated as a function of theta (second
2793  solution);
2794 
2795  P1x, P1y, .... , P2z are stored in the array POINTS[0-5]; the status is stored
2796  in *STATUS.
2797 
2798 */
2799 
2800 
2801 
2802 
2803 //--------------------------------------------------------------------------
2804 
2805 
2806 // from the resolving formula on page 23 of Gianluigi's notes, setting r=0.
2807 
2808 
2809  ax = C0x - Ox;
2810  ay = C0y - Oy;
2811  DELTA = R*R*(vx*vx+vy*vy) - (vx*ay - vy*ax)*(vx*ay - vy*ax);
2812  AAA = vx*vx+vy*vy;
2813 
2814 
2815  if ( DELTA < 0. ) {
2816  *STATUS=-2;
2817  } else if (AAA == 0.){
2818  *STATUS=-3;
2819  } else if (DELTA == 0.){
2820  *STATUS=1;
2821  POINTS[0] = C0x - vx*(vx*ax + vy*ay)/AAA;
2822  POINTS[1] = C0y - vy*(vx*ax + vy*ay)/AAA;
2823  POINTS[2] = C0z - vz*(vx*ax + vy*ay)/AAA;
2824  }else {
2825  *STATUS=0;
2826  DELTA = sqrt(DELTA);
2827  POINTS[0] = C0x - vx*(vx*ax + vy*ay - DELTA)/AAA;
2828  POINTS[1] = C0y - vy*(vx*ax + vy*ay - DELTA)/AAA;
2829  POINTS[2] = C0z - vz*(vx*ax + vy*ay - DELTA)/AAA;
2830  POINTS[3] = C0x - vx*(vx*ax + vy*ay + DELTA)/AAA;
2831  POINTS[4] = C0y - vy*(vx*ax + vy*ay + DELTA)/AAA;
2832  POINTS[5] = C0z - vz*(vx*ax + vy*ay + DELTA)/AAA;
2833  }
2834 
2835  return;
2836 
2837 
2838 }
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t
Double_t R
Definition: checkhelixhit.C:61
void PndSttTrackFinderReal::ChooseEntranceExit ( Double_t  Oxx,
Double_t  Oyy,
Short_t  flag,
Short_t  Charge,
Double_t  FiStart,
Short_t  nIntersections[2],
Double_t  XintersectionList[][2],
Double_t  YintersectionList[][2],
Double_t  Xcross[2],
Double_t  Ycross[2] 
)
private

Definition at line 11956 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, fi, i, Merge_Sort(), and PI.

Referenced by FindTrackEntranceExitbiHexagon(), and FindTrackEntranceExitHexagonCircle().

11968 {
11969 
11970  Short_t i,
11971  j;
11972 // this method works under the hypothesis that flag=0 or 2 only.
11973 
11974  if(flag == 0) {
11975  if(Charge > 0) {
11976  for(j=0;j<2;j++){ // j=0 --> inner polygon; j=1 --> outer polygon.
11977  Short_t auxIndex[nIntersections[j]];
11978  Double_t fi[nIntersections[j]];
11979  for( i=0;i<nIntersections[j];i++){
11980  fi[i] = atan2(YintersectionList[i][j]-Oyy,
11981  XintersectionList[i][j]-Oxx);
11982  if( fi[i] > FiStart) fi[i] -= 2.*PI;
11983  if( fi[i] > FiStart) fi[i] = FiStart;
11984  auxIndex[i]=i;
11985  } // end of for( i=0;i<nIntersections[j];i++)
11986  Merge_Sort( nIntersections[j], fi, auxIndex);
11987  Xcross[j] = XintersectionList[ auxIndex[nIntersections[j]-1] ][j];
11988  Ycross[j] = YintersectionList[ auxIndex[nIntersections[j]-1] ][j];
11989  } // end of for(j=0;j<2;j++)
11990 
11991  } else {
11992  for(j=0;j<2;j++){ // j=0 --> inner polygon; j=1 --> outer polygon.
11993  Short_t auxIndex[nIntersections[j]];
11994  Double_t fi[nIntersections[j]];
11995  for( i=0;i<nIntersections[j];i++){
11996  fi[i] = atan2(YintersectionList[i][j]-Oyy,
11997  XintersectionList[i][j]-Oxx);
11998  if( fi[i] < FiStart) fi[i] += 2.*PI;
11999  if( fi[i] < FiStart) fi[i] = FiStart;
12000  auxIndex[i]=i;
12001  } // end of for( i=0;i<nIntersections[j];i++)
12002  Merge_Sort( nIntersections[j], fi, auxIndex);
12003  Xcross[j] = XintersectionList[ auxIndex[0] ][j];
12004  Ycross[j] = YintersectionList[ auxIndex[0] ][j];
12005  } // end of for(j=0;j<2;j++)
12006  }
12007 
12008  } else{ // therefore it means that flag = 2
12009 
12010  Short_t auxIndex[nIntersections[0]];
12011  Double_t fi[nIntersections[0]];
12012  if(Charge > 0) {
12013  for( i=0;i<nIntersections[0];i++){
12014  fi[i] = atan2(YintersectionList[i][0]-Oyy,
12015  XintersectionList[i][0]-Oxx);
12016  if( fi[i] > FiStart) fi[i] -= 2.*PI;
12017  if( fi[i] > FiStart) fi[i] = FiStart;
12018  auxIndex[i]=i;
12019  } // end of for( i=0;i<nIntersections[0];i++)
12020  Merge_Sort( nIntersections[0], fi, auxIndex);
12021  Xcross[0] = XintersectionList[ auxIndex[nIntersections[0]-1] ][0];
12022  Ycross[0] = YintersectionList[ auxIndex[nIntersections[0]-1] ][0];
12023  Xcross[1] = XintersectionList[ auxIndex[nIntersections[0]-2] ][0];
12024  Ycross[1] = YintersectionList[ auxIndex[nIntersections[0]-2] ][0];
12025 
12026  } else {
12027  for( i=0;i<nIntersections[0];i++){
12028  fi[i] = atan2(YintersectionList[i][0]-Oyy,
12029  XintersectionList[i][0]-Oxx);
12030  if( fi[i] < FiStart) fi[i] += 2.*PI;
12031  if( fi[i] < FiStart) fi[i] = FiStart;
12032  auxIndex[i]=i;
12033  } // end of for( i=0;i<nIntersections[0];i++)
12034  Merge_Sort( nIntersections[0], fi, auxIndex);
12035  Xcross[0] = XintersectionList[ auxIndex[0] ][0];
12036  Ycross[0] = YintersectionList[ auxIndex[0] ][0];
12037  Xcross[1] = XintersectionList[ auxIndex[1] ][0];
12038  Ycross[1] = YintersectionList[ auxIndex[1] ][0];
12039  }
12040  } // end of if(flag == 0)
12041 
12042 
12043 
12044 
12045 }
Int_t i
Definition: run_full.C:25
TFile * fi
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
void PndSttTrackFinderReal::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] 
)
private

Definition at line 12056 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, fi, i, Merge_Sort(), and PI.

Referenced by FindTrackEntranceExitbiHexagonLeft(), FindTrackEntranceExitbiHexagonRight(), FindTrackEntranceExitHexagonCircleLeft(), and FindTrackEntranceExitHexagonCircleRight().

12067 {
12068 
12069  Short_t i,
12070  j;
12071 // this method works under the hypothesis that there are at least 2 intersections.
12072  if (nIntersections<2) return;
12073 
12074  if(Charge > 0) {
12075  Short_t auxIndex[nIntersections];
12076  Double_t fi[nIntersections];
12077  for( i=0;i<nIntersections;i++){
12078  fi[i] = atan2(YintersectionList[i]-Oyy,
12079  XintersectionList[i]-Oxx);
12080  if( fi[i] > FiStart) fi[i] -= 2.*PI;
12081  if( fi[i] > FiStart) fi[i] = FiStart;
12082  auxIndex[i]=i;
12083  } // end of for( i=0;i<nIntersections[j];i++)
12084  Merge_Sort( nIntersections, fi, auxIndex);
12085  Xcross[0] = XintersectionList[ auxIndex[nIntersections-1] ];
12086  Ycross[0] = YintersectionList[ auxIndex[nIntersections-1] ];
12087  Xcross[1] = XintersectionList[ auxIndex[nIntersections-2] ];
12088  Ycross[1] = YintersectionList[ auxIndex[nIntersections-2] ];
12089 
12090  } else {
12091  Short_t auxIndex[nIntersections];
12092  Double_t fi[nIntersections];
12093  for( i=0;i<nIntersections;i++){
12094  fi[i] = atan2(YintersectionList[i]-Oyy,
12095  XintersectionList[i]-Oxx);
12096  if( fi[i] < FiStart) fi[i] += 2.*PI;
12097  if( fi[i] < FiStart) fi[i] = FiStart;
12098  auxIndex[i]=i;
12099  } // end of for( i=0;i<nIntersections;i++)
12100  Merge_Sort( nIntersections, fi, auxIndex);
12101  Xcross[0] = XintersectionList[ auxIndex[0] ];
12102  Ycross[0] = YintersectionList[ auxIndex[0] ];
12103  Xcross[1] = XintersectionList[ auxIndex[1] ];
12104  Ycross[1] = YintersectionList[ auxIndex[1] ];
12105  }
12106 
12107 
12108 
12109 
12110 }
Int_t i
Definition: run_full.C:25
TFile * fi
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
PndSttTrackFinder::ClassDef ( PndSttTrackFinder  ,
 
)
protectedinherited
PndSttTrackFinderReal::ClassDef ( PndSttTrackFinderReal  ,
 
)
private
void PndSttTrackFinderReal::clustering2 ( Short_t  vec1[2],
int  nListElements,
Short_t  List[][2],
int &  nClusterElementsFound,
Short_t  ClusterElementsFound[][2],
int &  nRemainingElements,
Short_t  RemainingElements[][2] 
)
private

Definition at line 3274 of file PndSttTrackFinderReal.cxx.

References i, and iscontiguous().

3280 {
3281  int i;
3282  Short_t vec2[2];
3283 
3284  nClusterElementsFound=0;
3285  nRemainingElements=0;
3286  for(i=0; i<nListElements; i++){
3287  vec2[0]=List[i][0];
3288  vec2[1]=List[i][1];
3289  if( iscontiguous(2, vec1, vec2) ){
3290  ClusterElementsFound[nClusterElementsFound][0] = vec2[0];
3291  ClusterElementsFound[nClusterElementsFound][1] = vec2[1];
3292  nClusterElementsFound++;
3293  } else {
3294  RemainingElements[nRemainingElements][0] = vec2[0];
3295  RemainingElements[nRemainingElements][1] = vec2[1];
3296  nRemainingElements++;
3297  }
3298  }
3299 
3300  return;
3301 }
bool iscontiguous(int ncomponents, Short_t *vec1, Short_t *vec2)
Int_t i
Definition: run_full.C:25
void PndSttTrackFinderReal::clustering3 ( Short_t  vec1[3],
int  nListElements,
Short_t  List[][3],
int &  nClusterElementsFound,
Short_t  ClusterElementsFound[][3],
int &  nRemainingElements,
Short_t  RemainingElements[][3] 
)
private

Definition at line 3307 of file PndSttTrackFinderReal.cxx.

References i, and iscontiguous().

3313 {
3314  int i;
3315  Short_t vec2[3];
3316 
3317  nClusterElementsFound=0;
3318  nRemainingElements=0;
3319  for(i=0; i<nListElements; i++){
3320  vec2[0]=List[i][0];
3321  vec2[1]=List[i][1];
3322  vec2[2]=List[i][2];
3323  if( iscontiguous(3, vec1, vec2) ){
3324  ClusterElementsFound[nClusterElementsFound][0] = vec2[0];
3325  ClusterElementsFound[nClusterElementsFound][1] = vec2[1];
3326  ClusterElementsFound[nClusterElementsFound][2] = vec2[2];
3327  nClusterElementsFound++;
3328  } else {
3329  RemainingElements[nRemainingElements][0] = vec2[0];
3330  RemainingElements[nRemainingElements][1] = vec2[1];
3331  RemainingElements[nRemainingElements][2] = vec2[2];
3332  nRemainingElements++;
3333  }
3334  }
3335 
3336  return;
3337 }
bool iscontiguous(int ncomponents, Short_t *vec1, Short_t *vec2)
Int_t i
Definition: run_full.C:25
void PndSttTrackFinderReal::disegnaAssiXY ( FILE *  MACRO,
double  xmin,
double  xmax,
double  ymin,
double  ymax 
)
private

Definition at line 13846 of file PndSttTrackFinderReal.cxx.

Referenced by WriteMacroParallelAssociatedHits(), WriteMacroParallelAssociatedHitswithMC(), WriteMacroParallelHitsGeneral(), and WriteMacroParallelHitswithRfromMC().

13853 {
13854 
13855  fprintf(MACRO,"TGaxis *Assex = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",xmin,0.,xmax,0.,xmin,xmax);
13856  fprintf(MACRO,"Assex->SetTitle(\"X\");\n");
13857  fprintf(MACRO,"Assex->SetTitleOffset(1.5);\n");
13858  fprintf(MACRO,"Assex->Draw();\n");
13859  fprintf(MACRO,"TGaxis *Assey = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n", 0.,ymin,0.,ymax,ymin,ymax);
13860  fprintf(MACRO,"Assey->SetTitle(\"Y\");\n");
13861  fprintf(MACRO,"Assey->SetTitleOffset(1.5);\n");
13862  fprintf(MACRO,"Assey->Draw();\n");
13863 
13864 }
Double_t xmax
Double_t xmin
void PndSttTrackFinderReal::disegnaSciTilHit ( FILE *  MACRO,
int  ScitilHit,
double  posx,
double  posy,
int  tipo 
)
private

Definition at line 13778 of file PndSttTrackFinderReal.cxx.

References DIMENSIONSCITIL, L, R, and sqrt().

Referenced by WriteMacroParallelAssociatedHits(), WriteMacroParallelAssociatedHitswithMC(), WriteMacroParallelHitsGeneral(), WriteMacroParallelHitsGeneralConformalwithMC(), WriteMacroSkewAssociatedHits(), and WriteMacroSkewAssociatedHitswithMC().

13785 {
13786  double x1,x2,y1,y2,L,R,RR;
13787 
13788 
13789  L=DIMENSIONSCITIL/2.;
13790 
13791  if(tipo==0){ // SciTil disegnate in XY.
13792  R = sqrt(posx*posx+posy*posy);
13793  x1 = posx + posy*L/R;
13794  x2 = posx - posy*L/R;
13795  y1 = posy - posx*L/R;
13796  y2 = posy + posx*L/R;
13797  } else if (tipo==1) {// SciTil disegnate in SZ.
13798  x1 = posx - L;
13799  x2 = posx + L;
13800  y1 = posy;
13801  y2 = posy;
13802  } else { // SciTil disegnate in UV.
13803  RR = posx*posx+posy*posy;
13804  R = sqrt(RR);
13805  x1 = posx + posy*L/R;
13806  x1 /= RR;
13807  x2 = posx - posy*L/R;
13808  x2 /= RR;
13809  y1 = posy - posx*L/R;
13810  y1 /= RR;
13811  y2 = posy + posx*L/R;
13812  y2 /= RR;
13813 
13814  }
13815 
13816 
13817  fprintf(MACRO,"TLine *Tile%d = new TLine(%f,%f,%f,%f);\n",ScitilHit,x1,y1,x2,y2);
13818  fprintf(MACRO,"Tile%d->SetLineColor(1);\n",ScitilHit);
13819  if(tipo==0){
13820  // disegna in XY.
13821  fprintf(MACRO,"Tile%d->SetLineWidth(2);\n",ScitilHit);
13822  } else if (tipo==1) {
13823  // disegna in SZ.
13824  fprintf(MACRO,"Tile%d->SetLineWidth(3);\n",ScitilHit);
13825  } else {
13826  // disegna in UV.
13827  fprintf(MACRO,"Tile%d->SetLineWidth(3);\n",ScitilHit);
13828  }
13829  fprintf(MACRO,"Tile%d->Draw();\n",ScitilHit);
13830 /*
13831  fprintf(MACRO,"TMarker* SciT%d = new TMarker(%f,%f,%d);\n",
13832  ScitilHit,posx,posy,30);
13833  fprintf(MACRO,"SciT%d->SetMarkerSize(1.5);\n",ScitilHit);
13834  fprintf(MACRO,"SciT%d->SetMarkerColor(1);\nSciT%d->Draw();\n"
13835  ,ScitilHit,ScitilHit);
13836 */
13837 }
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t R
Definition: checkhelixhit.C:61
static const Double_t DIMENSIONSCITIL
Int_t PndSttTrackFinderReal::DoFind ( TClonesArray *  trackCandArray,
TClonesArray *  trackArray,
TClonesArray *  helixHitArray 
)
virtual

Track finding algorithm

Implements PndSttTrackFinder.

Definition at line 447 of file PndSttTrackFinderReal.cxx.

References PndTrackCand::AddHit(), angle, AssociateBetterAfterFitSkewHitsToXYTrack(), AssociateFoundTrackstoMCbis(), AssociateSkewHitsToXYTrack(), atan2(), BFIELD, CVEL, DIMENSIONSCITIL, doMcComparison, Double_t, fabs(), fHitCollectionList, FindTrackInXYProjection(), FitSZspace(), FixDiscontinuitiesFiangleinSZplane(), fMCTrackArray, fParticle, fPointCollectionList, fSciTHitArray, fSttBranch, fTubeArray, g, GetEntriesFast(), PndSttTube::GetHalfLength(), GetHitFromCollections(), PndSttHit::GetIsochrone(), PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), GetPointFromCollections(), PndSttTube::GetPosition(), PndSciTHit::GetPosition(), PndMCTrack::GetStartVertex(), PndSttHit::GetTubeID(), PndSttTube::GetWireDirection(), HANDLE, i, InclusionListSciTil, infoparal, infoskew, iplotta, istampa, IVOLTE, jj, ListSciTilHitsinTrack, MAXHITSINCELL, MAXMCTRACKS, MAXTRACKSPEREVENT, Merge_Sort(), MINIMUMHITSPERTRACK, nFidivConformal, NHITSINFIT, nHitsInMCTrack, nmassimo, nmaxHits, nmaxHitsInTrack, nmaxinclinationversors, nMCTracks, nRdivConformal, nSciTilHits, nSciTilHitsinTrack, nSttSkewhit, nSttSkewhitInMCTrack, PHANDLEX, PHANDLEY, PHANDLEZ, PI, PMAX, pMCtr, PndSttBoxConformalFilling(), PndSttFromXYtoConformal(), PndSttInfoXYZParal(), PndSttInfoXYZSkew(), PndSttOrderingSkewandParallel(), Position(), posizSciTil, R, S_SciTilHitsinTrack, SEMILENGTH_STRAIGHT, PndTrack::SetFlag(), PndTrackCand::setMcTrackId(), PndTrack::SetRefIndex(), SHANDLEX, SHANDLEY, SHANDLEZ, sqrt(), status, STRAWRADIUS, veritaMC, WriteMacroParallelAssociatedHits(), WriteMacroParallelAssociatedHitswithMC(), WriteMacroParallelHitsGeneral(), WriteMacroParallelHitsGeneralConformalwithMC(), WriteMacroSkewAssociatedHits(), WriteMacroSkewAssociatedHitswithMC(), YesSciTil, Z, and ZCENTER_STRAIGHT.

448 {
449 
450  bool
451  flaggo,
452  outcome;
453  Int_t i, j, iaccept, ii,jj,k,kk,n1,n2,n3,
454  i1,j1,k1,imaxima, jmaxima,
455  iofmax, jofmax, kofmax,
456  index[nmaxHits], integer,
457  Ncirc, nSkew1, nSkew2,
458  n_K, n_FI0, n_R, n_D, n_Fi,STATUS,
459  Nremaining, Nremaining2,
460  NumberofMaximaDFiR,
461  NumberofMaximaKFI0,
462  nAssociatedParallelHits ;
463 
464 
465 
466  Short_t
467  emme,
468  exitstatus,
469  inclination_type,
470  istep,
471 // nSciTilHitsinTrack[MAXTRACKSPEREVENT],
472  auxIndex[nmaxHits],
473  OLDinfoparal[nmaxHits];
474 
475  Short_t
476  Charge[MAXTRACKSPEREVENT],
477  Status[MAXTRACKSPEREVENT],
478  daTrackFoundaTrackMC[MAXTRACKSPEREVENT],
480 
481  Double_t aaa, ddd, delta, deltabis, deltaZ, mindis, distanza, fi_hit,
482  ap1, ap2, ap3, carica, cross1, cross2, cross3,
483  dummy,
484  lowlimit[MAXTRACKSPEREVENT],
485  uplimit[MAXTRACKSPEREVENT],
486  info[nmaxHits][7],
487  WDX, WDY, WDZ,
488  auxRvalues[nmaxHits],
489  inclination[nmaxinclinationversors][3];
490 
491  PndSttHit* ListPointer_to_Hit[nmaxHits];
492 
493 
494  inclination[0][0]=inclination[0][1]=0., inclination[0][2]=1.;
495  Int_t Nincl = 1, Ninclinate, iHit;
496  Int_t Minclinations[nmaxinclinationversors];
497 
498 
499 
500  bool
501  InclusionList[nmaxHits], // list of parallel hits already assigned to a track or with multiple hits.
502  InclusionListSkew[nmaxHits], // list of skew hits with multiple hits
503  InclusionListbis[nmaxHits], // list of || hits ONLY with multiple hits
504  InclusionListSkewbis[nmaxHits], // list of skew hits ONLY with multiple hits (duplicate of
505  // InclusionListSkew)
506 
507 
508 // TypeConf[MAXTRACKSPEREVENT], // if TypeConf[]=false --> the track is a line in the Conformal space,
509  // if TypeConf[]=true it is a crf;
510  TypeConfSkew[MAXTRACKSPEREVENT],
511  GoodTrack[MAXTRACKSPEREVENT]; // yes = track found passes minimal requirements
512 
513 
514  Short_t iParHit,
515  nFicell,
516  nRcell;
517 
518  Short_t
519  exphit,
520  iExclude,
521  imc,
522  jexp,
523  mchit,
524  nTracksFoundSoFar,
525  NNN,
526  Nouter,
527  nTotalHits[MAXTRACKSPEREVENT],
528  TemporarynSttSkewhitinTrack,
530  TemporarySkewList[nmaxHits][2],
531  nHitsinTrack[MAXTRACKSPEREVENT],
532  nSttSkewhitinTrack[MAXTRACKSPEREVENT],
533  tempore[nmaxHits],
534  ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
535  ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
536  nMCParalAlone[MAXTRACKSPEREVENT],
537  nMCSkewAlone[MAXTRACKSPEREVENT],
538  MCParalAloneList[MAXTRACKSPEREVENT][nmaxHits],
539  MCSkewAloneList[MAXTRACKSPEREVENT][nmaxHits],
540  nParalCommon[MAXTRACKSPEREVENT],
541  ParalCommonList[MAXTRACKSPEREVENT][nmaxHits],
542  nSpuriParinTrack[MAXTRACKSPEREVENT],
543  ParSpuriList[MAXTRACKSPEREVENT][nmaxHits],
544  nSkewCommon[MAXTRACKSPEREVENT],
545  SkewCommonList[MAXTRACKSPEREVENT][nmaxHits],
546  nSpuriSkewinTrack[MAXTRACKSPEREVENT],
547  SkewSpuriList[MAXTRACKSPEREVENT][nmaxHits],
548  RConformalIndex[nmaxHits], // given a Hit number it gives its radial box number
549  FiConformalIndex[nmaxHits], // given a Hit number it gives its azimuthal box number
550  nBoxConformal[nRdivConformal][nFidivConformal]; // first index -> radial divisions, 2nd index -> azimuthal divisions; n. of
551  // hits falling in this cell
552 
553  Short_t HitsinBoxConformal[MAXHITSINCELL][nRdivConformal][nFidivConformal];
554  // first index -> radial divisions, 2nd index -> azimuthal divisions;
555 
556 
557  Int_t status;
558 
559 
560 
561  int iimax,jjmax, ncount;
562 
563 
564  Double_t angle, Distance, max1, HoughR, HoughD, HoughFi, HoughKAPPA, HoughFI0,
565  Px, Py,
566  tempR, tempD,tempFi,tempKAPPA,tempFI0,
567  Rlow, Rup, Dlow, Dup,Filow,Fiup, KAPPAlow, KAPPAup, FI0low, FI0up,
568  gamma;
569 
570  Double_t
571  D,
572  Fi,
573  ptotal,
574  Fi_low_limit[MAXTRACKSPEREVENT],
575  Fi_up_limit[MAXTRACKSPEREVENT],
576  Fi_initial_helix_referenceframe[MAXTRACKSPEREVENT],
577  Fi_final_helix_referenceframe[MAXTRACKSPEREVENT],
579  Ox[MAXTRACKSPEREVENT],
580  Oy[MAXTRACKSPEREVENT],
581  KAPPA[MAXTRACKSPEREVENT],
582  FI0[MAXTRACKSPEREVENT],
583  trajectory_vertex[3],
584  infoparalConformal[nmaxHits][5],
585  S[2*nmaxHits],
586  tmpErrorZDrift[nmaxHitsInTrack],
587  tmpS[nmaxHitsInTrack],
588  tmpZ[nmaxHitsInTrack],
589  tmpZDrift[nmaxHitsInTrack],
590  Z[2*nmaxHits],
591  temporeS[nmaxHits],
592  temporeZ[nmaxHits],
593  ZDrift[2*nmaxHits],
594  ZErrorafterTilt[2*nmaxHits],
595  temporeZDrift[nmaxHits],
596  temporeZErrorafterTilt[nmaxHits],
597  Posiz[3],
598  Posiz1[3],
599  Posiz2[3],
600  versor[3],
601 // U[MAXTRACKSPEREVENT][nmaxHits],
602 // V[MAXTRACKSPEREVENT][nmaxHits],
603  Xpos_for_LHeTrack[nmaxHits],
604  Ypos_for_LHeTrack[nmaxHits],
605  Zpos_for_LHeTrack[nmaxHits],
606  Sfinal[MAXTRACKSPEREVENT][nmaxHits],
607  Zfinal[MAXTRACKSPEREVENT][nmaxHits],
608  ZDriftfinal[MAXTRACKSPEREVENT][nmaxHits],
609  ZErrorafterTiltfinal[MAXTRACKSPEREVENT][nmaxHits];
610 
611 
612 
613  Float_t RemainingR[nmaxHits],
614  RemainingFi[nmaxHits],
615  RemainingD[nmaxHits],
616  RemainingCX[nmaxHits],
617  RemainingCY[nmaxHits],
618  RemainingKAPPA[nmaxHits],
619  RemainingFI0[nmaxHits];
620  bool GoodSkewFit[nmaxHits];
621 
622 
623  bool temporflag[8],
624  IFLAG;
625 
626 
627  CalculatedCircles Result;
628  CalculatedHelix HelixResult;
629 // AssociatedHitsToHelix ResultAssociatedHits ;
630 
631  char nomef[100], nome[30],titolo[100];
632 
633 
634 
635 //------------------------------------ modifiche Gianluigi, 9-7-08
636 
637  IVOLTE++;
638 
639  if(istampa>0)
640  cout<<"\nEntering in PndSttTrackFinderReal : evt (starting from 0) n. "<<IVOLTE<<endl;
641 
642 //------------------------------------ fine modifiche Gianluigi, 9-7-08
643 
644 
645  // Check pointers
646  if (fHitCollectionList.GetEntries() == 0)
647  {
648  cout << "-E- PndSttTrackFinderReal::DoFind: "
649  << "No hit arrays present, call AddHitCollection() first (at least once), return -1! "
650  << endl;
651  return -1;
652  }
653 
654  if (fPointCollectionList.GetEntries() == 0)
655  {
656  cout << "-E- PndSttTrackFinderReal::DoFind: "
657  << "No point arrays present, call AddHitCollection() first (at least once), return -1! "
658  << endl;
659  return -1;
660  }
661 
662  if ( !trackCandArray )
663  {
664  cout << "-E- PndSttTrackFinderReal::DoFind: "
665  << "Track array missing, return -1!" << endl;
666  return -1;
667  }
668 
669 // PndMCTrack* pMCtr = NULL; // questo e' gia' definito in PndSttTrackFinderReal.h
670  nMCTracks = fMCTrackArray->GetEntriesFast(); // num. tracce/evento
671  if (nMCTracks ==0){
672  cout<<"da PndSttTrackFinderReal : N. di MC truth tracks = 0, return -1!\n"
673  <<endl;
674  return -1;
675  } else if(nMCTracks> MAXMCTRACKS){
676  cout<<"da PndSttTrackFinderReal : N. di MC truth tracks = "<<nMCTracks
677  <<" and it is > MAXMCTRACKS = "<<MAXMCTRACKS<<", setting it equal to MAXMCTRACKS.\n";
679  }
680 
681 
682 
683  if(istampa>=1) cout<<"Gianluigi, evento n. "<<IVOLTE<<", n. tracce MC = "<<nMCTracks<<endl;
684 
685  // Number of STT hits
686  Int_t Nhits = 0;
687 
688  for (Int_t hitListCounter = 0; hitListCounter < fHitCollectionList.GetEntries(); hitListCounter++)
689  {
690  Nhits += ((TClonesArray *)fHitCollectionList.At(hitListCounter))->GetEntriesFast();
691  }
692 
693  if(Nhits < MINIMUMHITSPERTRACK) {
694  cout<<"from PndSttTrackFinderReal : # Stt hits (|| + //) = "<<Nhits
695  <<" and it is < MINIMUMHITSPERTRACK = "
696  <<MINIMUMHITSPERTRACK<<", return -10!"<<endl;
697  return -10;
698  }
699 
700  if(Nhits > nmaxHits ) {
701 
702  cout<<"da PndSttTrackFinderReal : N. di Stt Hits = "<<Nhits
703  <<" and it is > nmaxHits (="<<nmaxHits
704  <<"), therefore consider only the first "<<nmaxHits<<" hits\n"<<endl;
705  Nhits= nmaxHits;
706  }
707 
708 
709 
710 
711 //------------------------ loading SciTil hits.
712  nSciTilHits = 0;
713  if(YesSciTil) {
714  if( fSciTHitArray != NULL){
715  // number SciTil hits/event
716  nSciTilHits = fSciTHitArray->GetEntriesFast();
717  if(istampa>0)
718  cout<<"da PndSttTrackFinderReal, event "<<IVOLTE<<", "<<nSciTilHits
719  <<" SciTil hits presenti inizialmente.\n";
720  }
721  if( nSciTilHits>0){
722  PndSciTHit *pPndSciTHit;
723  TVector3 posiz;
724 
725  // the first SciTil hit; this cannot be duplicate hit by definition.
726  pPndSciTHit = (PndSciTHit*) fSciTHitArray->At(0);
727  posiz = pPndSciTHit->GetPosition();
728 
729 if(istampa>0)cout<<"da PndSttTrackFinderReal, evt "<<IVOLTE<<
730  ", SciTil non purgati, Xpos "<<posiz.X()<<", Ypos "<<
731  posiz.Y()<<", Zpos "<<posiz.Z()<<endl;
732 
733  posizSciTil[0][0]=posiz.X();
734  posizSciTil[0][1]=posiz.Y();
735  posizSciTil[0][2]=posiz.Z();
736  InclusionListSciTil[0]= true;
737  iaccept=1;
738  // the other SciTil hits; purge them if they are duplicate.
739  for(j=1; j<nSciTilHits; j++){
740  pPndSciTHit = (PndSciTHit*) fSciTHitArray->At(j);
741  posiz = pPndSciTHit->GetPosition();
742 
743 if(istampa>0)cout<<"da PndSttTrackFinderReal, evt. "<<IVOLTE<<", SciTil non purgati, Xpos "
744  <<posiz.X()<<", Ypos "<<
745  posiz.Y()<<", Zpos "<<posiz.Z()<<endl;
746 
747  // purging the duplicate SciTil hits.
748 
749  flaggo=true;
750  for(k=0; k<iaccept; k++){
751  if(
752  (fabs(posiz.X() - posizSciTil[k][0])< 1.e-20)
753  &&
754  (fabs(posiz.Y() - posizSciTil[k][1])< 1.e-20)
755  &&
756  (fabs(posiz.Z() - posizSciTil[k][2])< 1.e-20)
757  ){
758  flaggo=false;
759  break;
760  } // end of if((fabs(posiz.X() - old...
761  } // end of for(k=0; k<iaccept; k++)
762  if(flaggo){
763  posizSciTil[iaccept][0]=posiz.X();
764  posizSciTil[iaccept][1]=posiz.Y();
765  posizSciTil[iaccept][2]=posiz.Z();
766  InclusionListSciTil[iaccept]= true;
767  iaccept++;
768  }
769 
770  } // end of for(j=0; j<nSciTilHits; j++)
771 
772  nSciTilHits=iaccept;
773 
774  } // end of if( nSciTilHits>0){
775 
776 
777 //-----------stampe.
778 if(istampa>0){
779  cout<<"da PndSttTrackFinderReal, dopo purga di SciTil; evt. "<<IVOLTE
780  <<", n. hits = "<<nSciTilHits<<endl;
781  for(j=0; j<nSciTilHits; j++){
782  cout<<"da PndSttTrackFinderReal, evt. "<<IVOLTE<<
783  ", SciTil Xpos "<<posizSciTil[j][0]<<", Ypos "<<
784  posizSciTil[j][1]<<", Zpos "<<posizSciTil[j][2]<<", loro InclusionList [0=false] "
785  <<InclusionListSciTil[j]<<endl;
786  }
787 }
788 //---------- fine stampe.
789 
790  } // end of if(YesSciTil)
791 
792 //--------------------------------
793 
794 
795 
796  // Initialise control counters
797  Int_t nNoTrack = 0;
798  Int_t nNoSttPoint = 0;
799  Int_t nNoSttHit = 0;
800 
801  // Create pointers to hit and SttPoint
802  PndSttHit* pMhit = NULL;
803  FairMCPoint* pMCpt = NULL;
804 // PndSttTrack* pTrck[MAXTRACKSPEREVENT] ; // this is for the hits found by pattern recognition
805 
806 
807  // Declare some variables outside the loops
808  Int_t trackIndex = 0; // STTTrack index
809 
810  // Create STL map from MCtrack index to number of valid SttHits
811  map<Int_t, map<Double_t, Int_t> >
812  hitMap;
813 
814 
815 
816  for(j=0; j<nmaxinclinationversors;j++){
817  Minclinations[j]=0;
818  }
819 
820  nSttSkewhit=Ninclinate=0;
821 
822 
823  if (istampa >= 1 ) cout<<"Gianluigi : da PndSttTrackFinderReal::DoFind : Nhits="<<Nhits<<endl;
824 
825  // generated momenta and starting position of each track
826 
827 
828 
829 
830  // Loop over hits
831  for (iHit = 0; iHit < Nhits; iHit++)
832  {
833  // hit point
834  pMhit = GetHitFromCollections(iHit); // <== PndSttHit
835  ListPointer_to_Hit[iHit]=pMhit;
836  if (!pMhit){
837  cout<<"from PndSttTrackFinderReal : # Stt hits pointer missing, skip this hit!\n";
838  continue;
839  }
840 
841  // MC point
842  Int_t ptIndex = pMhit->GetRefIndex();
843  if (ptIndex >= 0) {
844  pMCpt = GetPointFromCollections(iHit); // <== FairMCPoint
845 
846  }
847 
848 
849  // tubeID CHECK added
850  Int_t tubeID = pMhit->GetTubeID();
851  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeID);
852  // real hit center of tube coordinates
853  TVector3 center = tube->GetPosition();
854 
855  // drift radius
856  Double_t dradius = pMhit->GetIsochrone();
857 
858  // wire direction
859  TVector3 wiredirection = tube->GetWireDirection();
860 
861  // "real" MC coordinates (in + out)/2.
862 // TVector3 mcpoint;
863 // pMCpt->Position(mcpoint);
864 
865  if(wiredirection.Z() >=0.) {
866  WDX = wiredirection.X(); WDY = wiredirection.Y(); WDZ = wiredirection.Z();
867  } else {
868  WDX = -wiredirection.X(); WDY = -wiredirection.Y(); WDZ = -wiredirection.Z();
869  }
870 
871 
872  // stampe di controllo
873 
874 
875  info[iHit][0]= tube->GetPosition().X();
876  info[iHit][1]= tube->GetPosition().Y();
877  info[iHit][2]= tube->GetPosition().Z();
878  info[iHit][3]= dradius;
879  info[iHit][4]= tube->GetHalfLength();
880  if (ptIndex >= 0) {
881  info[iHit][6]= pMCpt->GetTrackID();
882  }else{
883  info[iHit][6]= -20.;
884  }
885 
886  if( fabs( WDX )< 0.00001 && fabs( WDY )< 0.00001 ){
887  info[iHit][5]= 1.;
888  infoparal[Minclinations[0]]= iHit ;
889  Minclinations[0]++;
890  ZCENTER_STRAIGHT = info[iHit][2]; // this works because just few lines below there is the
891  SEMILENGTH_STRAIGHT = info[iHit][4]; // requirement that Minclinations[0] > 2 (= at least 3 parallel straws)
892  } else {
893  flaggo=true;
894  for (i=2; i<=Nincl;i++) {
895  if (fabs( WDX-inclination[i-1][0] )< 0.00001
896  &&
897  fabs( WDY -inclination[i-1][1])< 0.00001
898  &&
899  fabs( WDZ -inclination[i-1][2])< 0.00001
900  ){
901  info[iHit][5]= i;
902  infoskew[Ninclinate]= iHit;
903  Ninclinate++;
904  Minclinations[i-1]++;
905  flaggo=false;
906  break;
907  }
908  }
909  if(flaggo){
910  Nincl++;
911  inclination[Nincl-1][0]=(Double_t) WDX;
912  inclination[Nincl-1][1]=(Double_t) WDY;
913  inclination[Nincl-1][2]=(Double_t) WDZ;
914  info[iHit][5]= Nincl;
915  infoskew[Ninclinate]= iHit;
916  Ninclinate++;
917  Minclinations[Nincl-1]++;
918  } // end if(flaggo)
919  }
920 
921  nSttSkewhit = Ninclinate;
922 
923 // calcoli validi solo per il MC -----------------------------
924 
925  if (ptIndex >= 0) {
926  veritaMC[iHit][0]= pMCpt->GetX();
927  veritaMC[iHit][1]= pMCpt->GetY();
928  veritaMC[iHit][2]= pMCpt->GetZ();
929  }
930 
931 // FromHitToMCTrack[iHit] = (Short_t) ( info[iHit][6] + 0.001 );
932 
933 
934 
935 //--------------- inizio stampaggi, stampe di controllo
936  if (istampa >= 2 && IVOLTE<= nmassimo) {
937  cout <<"iHit "<< iHit << endl;
938  if (ptIndex < 0) {
939 cout<<"from PndSttTrackFinderReal...this hit must be noise (RefIndex = "<<ptIndex
940  <<" )\n\t\t\tnot associate to any MC Track\n";
941 // cout<<" this hit belongs to MC track n. "<<pMCpt->GetTrackID()<<endl;
942  }else{
943  cout <<" MC point X, Y, Z space position " << veritaMC[iHit][0] << " " <<
944  veritaMC[iHit][1] << " " << veritaMC[iHit][2]<<endl;
945  }
946  cout <<" hit wire pos. in middle " << tube->GetPosition().X() << " " << tube->GetPosition().Y() << " " << tube->GetPosition().Z()
947  << "; R = "<<sqrt(tube->GetPosition().X()*tube->GetPosition().X()+tube->GetPosition().Y()*tube->GetPosition().Y())<< endl;
948  cout <<" wire direction, X, Y, Z (Z direction set always positive)"
949  << WDX<<" "<<WDY<<" "<<WDZ <<endl;
950  } // end of if(istampa >=
951 
952 //-------- fine stampaggi
953 
954 
955 
956 
957 
958  } // end of for (Int_t iHit = 0;
959 
960 
961 
962 
963 //--------------- inizio stampaggi
964 // if (istampa >= 2 && IVOLTE<= nmassimo) {
965  if (istampa >= 2 ) {
966  cout<<"Gianluigi : da PndSttTrackFinderReal::DoFind : Nhits totali ="
967  <<Nhits<<", n Hits || = "<<Minclinations[0]<<
968  ", n Hits skew = "<<nSttSkewhit<<endl;
969  } // end of if(istampa >=
970 //-------- fine stampaggi
971 
972 
973 
974 
975 // ordering the parallel hits by INCREASING CONFORMAL RADIUS or equivalently, decreasing spatial radius.
976 
977  for (j = 0; j< Minclinations[0]; j++){
978  auxIndex[j]=j;
979  auxRvalues[j]=
980  info[ infoparal[ j ] ][0]*
981  info[ infoparal[ j ] ][0]+
982  info[ infoparal[ j ] ][1]*
983  info[ infoparal[ j ] ][1];
984  OLDinfoparal[j]=infoparal[j];
985  }
986 
987 
988  Merge_Sort( Minclinations[0], auxRvalues, auxIndex);
989  for (j = 0; j< Minclinations[0]; j++){
990  infoparal[ Minclinations[0]-1-j] = OLDinfoparal[ auxIndex[ j ] ];
991  }
992 
993 //----------------------------
994 
995  if( Minclinations[0] < MINIMUMHITSPERTRACK ) {
996  cout<< "from PndSttTrackFinderReal : # Stt || hits = "<< Minclinations[0]
997  <<" and it is < MINIMUMHITSPERTRACK = "<<MINIMUMHITSPERTRACK<<", return 0!"<<endl;
998  return 0;
999  }
1000 
1001 
1002  for(i=0; i< Minclinations[0]; i++){
1003  InclusionList[ infoparal[i] ]= true ;
1004  InclusionListbis[ infoparal[i] ]= true ;
1005  }
1006  for(i=0; i< nSttSkewhit; i++){
1007  InclusionListSkew[ infoskew[i] ]= true ;
1008  InclusionListSkewbis[ infoskew[i] ]= true ;
1009  }
1010 
1011 
1012 
1013 
1014 
1015 //----------------------------------- Inclusion of straws with multiple hits
1016 
1017  // first the parallel straws
1018  for(i=0; i< Nhits-1; i++){
1019  if( info[i][5]==1.){
1020  if( InclusionList[ i ] ){
1021  for(j=i+1; j< Nhits; j++){
1022  if(InclusionList[ j ] && info[j][5]==1. &&
1023  fabs(info[i][0] - info[j][0])<1.e-20 &&
1024  fabs(info[i][1] - info[j][1])<1.e-20 )
1025  {
1026  InclusionList[j]= false ;
1027  InclusionListbis[j]= false ;
1028  }
1029  } // end of for(j=i+1; j< Nhits;; j++)
1030  } // end of if( InclusionList[ i ] )
1031  } else { // continuation of if( info[i][5]==1.)
1032 
1033  if( InclusionListSkew[ i ] ){
1034  for(j=i+1; j< Nhits; j++){
1035  if(InclusionListSkew[ j ] && info[j][5] != 1. &&
1036  fabs(info[i][0] - info[j][0])<1.e-20 &&
1037  fabs(info[i][1] - info[j][1])<1.e-20 )
1038  {
1039  InclusionListSkew[j]= false ;
1040  InclusionListSkewbis[j]= false ;
1041  }
1042  } // end of for(j=i+1; j< Nhits;; j++)
1043  } // end of if( InclusionList[ i ] )
1044 
1045 
1046  } // // end of if( info[i][5]==1.)
1047 
1048  } // end of for(i=0; i< Nhits-1; i++)
1049 
1050 
1051 
1052 
1053 
1054 //----------------------------------- end of Inclusion of straws with multiple hits
1055 
1056 
1057  trajectory_vertex[0]=trajectory_vertex[1]=trajectory_vertex[2]=0.;
1058 
1060  trajectory_vertex,
1061  info,
1062  Minclinations[0],
1063  infoparalConformal,
1064  &status
1065  );
1066 
1068  InclusionList,
1069  infoparalConformal,
1070  Minclinations[0],
1071  nBoxConformal,
1072  HitsinBoxConformal,
1073  RConformalIndex,
1074  FiConformalIndex
1075  );
1076 
1077 
1078 
1079 // start the track finding procedure
1080 
1081  Double_t
1082  U[MAXTRACKSPEREVENT][Minclinations[0]],
1083  V[MAXTRACKSPEREVENT][Minclinations[0]];
1084  nTracksFoundSoFar=0; // # tracks found
1085 
1086 
1087 //----- loop over the SciTil hits first;
1088  if(YesSciTil) {
1089 
1090  for(i=0; i<nSciTilHits ; i++) {
1091  if( nTracksFoundSoFar > MAXTRACKSPEREVENT) continue;
1092 
1093  nRcell = -1; // because SciTil hit is outside of the Stt system.
1094  Fi = atan2(posizSciTil[i][1],posizSciTil[i][0]) ;
1095  if ( Fi < 0. ) Fi += 2.*PI;
1096  nFicell = (Short_t) (0.5*nFidivConformal*Fi/PI);
1097  if(nFicell > nFidivConformal ) {
1098  nFicell = nFidivConformal;
1099  } else if (nFicell<0) {
1100  nFicell = 0;
1101  }
1102  outcome = FindTrackInXYProjection(
1103  -i-1, // seed hit; it is negative for SciTil Hits.
1104  nRcell,
1105  nFicell,
1106  Minclinations,
1107  info,
1108  InclusionList,
1109  RConformalIndex,
1110  FiConformalIndex,
1111  nBoxConformal,
1112  HitsinBoxConformal,
1113  nTracksFoundSoFar,
1114  nHitsinTrack,
1115  ListHitsinTrack,
1116  trajectory_vertex,
1117  infoparalConformal,
1118  posizSciTil[i][0],
1119  posizSciTil[i][1],
1120  &S_SciTilHitsinTrack[nTracksFoundSoFar][0],
1121  Ox,
1122  Oy,
1123  R,
1124  Fi_low_limit,
1125  Fi_up_limit,
1126  Fi_initial_helix_referenceframe,
1127  Fi_final_helix_referenceframe,
1128  Charge,
1129  &U[nTracksFoundSoFar][0],
1130  &V[nTracksFoundSoFar][0]
1131  );
1132  if(!outcome){
1133  continue;
1134  }
1135  for(j=0; j<nHitsinTrack[nTracksFoundSoFar]; j++){
1136  InclusionList[infoparal[ListHitsinTrack[nTracksFoundSoFar][j]]] = false;
1137  }
1138 
1139 
1140 //---------stampe.
1141 if(istampa>0){
1142  cout<<"PndTrackFinderReal, evt. "<<IVOLTE<<
1143  ", cand. "<<nTracksFoundSoFar<<
1144  ", partendo da SciTil, traccia n. "<<nTracksFoundSoFar<<",n SciTilhitsintrack "<<
1145  nSciTilHitsinTrack[nTracksFoundSoFar]<<" e loro stampa :\n";
1146  for(j=0; j<nSciTilHitsinTrack[nTracksFoundSoFar]; j++){
1147  cout<<"\t hit || n. "<<
1148  ListSciTilHitsinTrack[nTracksFoundSoFar][j]
1149  <<", S "<<S_SciTilHitsinTrack[nTracksFoundSoFar][j]<<endl;
1150  }
1151  cout<<"\t\tora stampa hit || :\n";
1152  for(j=0; j<nHitsinTrack[nTracksFoundSoFar]; j++){
1153  cout<<"\t hit || n. "<<
1154  infoparal[ListHitsinTrack[nTracksFoundSoFar][j]]<<endl;
1155  }
1156 }
1157 //-------fine stampe.
1158 
1159  nTracksFoundSoFar++;
1160 
1161  if( nTracksFoundSoFar >= MAXTRACKSPEREVENT ){
1162 cout<<"from PndSttTrackFinderReal : # n. Tracks found so far = "<<nTracksFoundSoFar
1163  <<" and it is >= MAXTRACKSPEREVENT ( = "<<MAXTRACKSPEREVENT
1164  <<"; rejecting this event and returning -15!\n";
1165  return -15;
1166  }
1167 
1168  } // end of for(i=0; i<nSciTilHits ; i++)
1169 
1170 
1171  } // end of if(YesSciTil)
1172 
1173 
1174 //----- end loop over the SciTil hits.
1175 
1176 
1177 
1178 
1179 //----- loop over the parallel hits
1180 
1181 // begins the first iteration with more severe cuts on the # hits in track candidate
1182 
1183  for(iParHit=0; iParHit<Minclinations[0] + 1 - MINIMUMHITSPERTRACK ; iParHit++) {
1184  if( nTracksFoundSoFar > MAXTRACKSPEREVENT) continue;
1185  if( ! InclusionList[ infoparal[iParHit] ] ) continue;
1186 
1187  nRcell = RConformalIndex[ infoparal[iParHit] ];
1188  nFicell = FiConformalIndex[infoparal[iParHit]];
1189 
1190  outcome = FindTrackInXYProjection(
1191  iParHit, // seed hit; it is positive for STT Hits.
1192  nRcell,
1193  nFicell,
1194  Minclinations,
1195  info,
1196  InclusionList,
1197  RConformalIndex,
1198  FiConformalIndex,
1199  nBoxConformal,
1200  HitsinBoxConformal,
1201  nTracksFoundSoFar,
1202  nHitsinTrack,
1203  ListHitsinTrack,
1204  trajectory_vertex,
1205  infoparalConformal,
1206  1., // dummy value, there is no SciTil info in this case;
1207  1., // dummy value, there is no SciTil info in this case
1208  &dummy,
1209  Ox,
1210  Oy,
1211  R,
1212  Fi_low_limit,
1213  Fi_up_limit,
1214  Fi_initial_helix_referenceframe,
1215  Fi_final_helix_referenceframe,
1216  Charge,
1217  &U[nTracksFoundSoFar][0],
1218  &V[nTracksFoundSoFar][0]
1219  );
1220 
1221  if(!outcome) continue;
1222 
1223 // -------- here the track and its hits were found, filling the Inclusion list
1224 
1225  for(j=0; j<nHitsinTrack[nTracksFoundSoFar]; j++){
1226  InclusionList[infoparal[ListHitsinTrack[nTracksFoundSoFar][j]]] = false;
1227  }
1228 //---------stampe.
1229 if(istampa>0){
1230  cout<<"PndTrackFinderReal, evt. "<<IVOLTE<<
1231  ", cand. "<<nTracksFoundSoFar<<
1232  ", partendo da Stt || hits, traccia n. "<<nTracksFoundSoFar<<",n SciTilhitsintrack "<<
1233  nSciTilHitsinTrack[nTracksFoundSoFar]<<" e loro stampa :\n";
1234  for(j=0; j<nSciTilHitsinTrack[nTracksFoundSoFar]; j++){
1235  cout<<"\t hit || n. "<<
1236  ListSciTilHitsinTrack[nTracksFoundSoFar][j]
1237  <<", S "<<S_SciTilHitsinTrack[nTracksFoundSoFar][j]<<endl;
1238  }
1239  cout<<"\t\tora stampa hit || :\n";
1240  for(j=0; j<nHitsinTrack[nTracksFoundSoFar]; j++){
1241  cout<<"\t hit || n. "<<
1242  infoparal[ListHitsinTrack[nTracksFoundSoFar][j]]<<endl;
1243  }
1244 }
1245 //-------fine stampe.
1246 
1247  nTracksFoundSoFar++;
1248 
1249  if( nTracksFoundSoFar >= MAXTRACKSPEREVENT ){
1250  cout<<"from PndSttTrackFinderReal : # n. Tracks found so far = "<<nTracksFoundSoFar
1251  <<" and it is >= MAXTRACKSPEREVENT ( = "<<MAXTRACKSPEREVENT
1252  <<"; rejecting this event and returning -15!\n";
1253  return -15;
1254  }
1255 
1256  } // end of for(iParHit=0; iParHit<Minclinations[0]+1-MINIMUMHITSPERTRACK; iParHit++)
1257 
1258 
1259 //------------ stampe.
1260 if(istampa>=2){
1261  for(j=0;j<nTracksFoundSoFar;j++){
1262  for(int jc=0;jc<nSciTilHitsinTrack[j];jc++){
1263  cout<<"from PndTrackFinderReal evt "<<IVOLTE<<", cand "<<jc<<
1264  ", SciTil hit n. "<<ListSciTilHitsinTrack[j][jc]
1265  <<", Z "<<posizSciTil[ ListSciTilHitsinTrack[j][jc] ][2]
1266  <<", S "<<S_SciTilHitsinTrack[j][jc]<<endl;
1267  }
1268  }
1269 }
1270 //---------------fine stampe.
1271 
1272 
1273 
1274 //-----------------------
1275 //-----------------------
1276 //-----------------------
1277 //----------------------- doing the fit with the skew hits for each XY plane track found
1278 //-----------------------
1279 //-----------------------
1280 //-----------------------
1281 
1282  bool keepit[nTracksFoundSoFar];
1283 
1284  for(i=0; i<nTracksFoundSoFar;i++){
1285 
1286  keepit[i]=true; // initialization.
1287 
1288  GoodSkewFit[i]=false; // flag indicating if the skew sector info has completed the parameter info;
1289  // a priori this is set false.
1290 
1291  nSttSkewhitinTrack[i]=0;
1292 
1293  if( Fi_low_limit[i] <-99998.) continue ; // this is when in XY the Helix circle is not in the
1294  // STT region; this in principle should never happen.
1295 
1296 //----- finding the skew hits intersecting this XY trajectory circle
1297 
1298 
1299  TemporarynSttSkewhitinTrack = AssociateSkewHitsToXYTrack(
1300  InclusionListSkew, // excluded only if it is a double hit
1301  Ox[i], // input : X of center of XY plane circle
1302  Oy[i], // input : Y of center of XY plane circle
1303  R[i], // input : Radius of XY plane circle
1304  info,
1305  inclination,
1306  Fi_low_limit[i],// in the Helix XY frame, taking into account the minimum/maximum
1307  Fi_up_limit[i], // radius of the STT detector.
1308  Charge[i],
1309  Fi_initial_helix_referenceframe[i],
1310  Fi_final_helix_referenceframe[i],
1311  TemporarySkewList, // output, list of selected skew hits (in skew numbering)
1312  S, // output, S coordinate of selected Skew hit
1313  Z, // output, Z coordinate of center wire of selected Skew hit
1314  ZDrift, // output, drift distance IN Z DIRECTION only, of selected Skew hit
1315  ZErrorafterTilt // output, Radius taking into account the tilt, IN Z DIRECTION only, of selected Skew hit
1316  );
1317 
1318  nSttSkewhitinTrack[i]=TemporarynSttSkewhitinTrack; // it can be also zero!
1319 // limit the total # hits to nmaxHitsInTrack
1320  if( nSttSkewhitinTrack[i]+nHitsinTrack[i] > nmaxHitsInTrack ) {
1321  if(nmaxHitsInTrack-nHitsinTrack[i]>0)nSttSkewhitinTrack[i]=nmaxHitsInTrack-nHitsinTrack[i];
1322  else nSttSkewhitinTrack[i]=0;
1323  }
1324 
1325 // here there are up to 2 SciTil hits in track.
1326  if(nSciTilHitsinTrack[i]>0){
1327  for(j=0;j<nSciTilHitsinTrack[i];j++){
1328  tmpS[j]= S_SciTilHitsinTrack[i][j]; // this is already between 0 and 2PI.
1329  tmpZ[j]=posizSciTil[ ListSciTilHitsinTrack[i][j] ][2],
1330  tmpZDrift[j]=-1., // conventional, to signal that this is not a STT hit.
1331  // error is intentionally overestimated for later use in SZ fit.
1332 // tmpErrorZDrift[j] = DIMENSIONSCITIL/sqrt(12.);
1333  tmpErrorZDrift[j] = DIMENSIONSCITIL/2.;
1334  }
1335  }
1336  for(j=0;j<nSttSkewhitinTrack[i];j++){
1337  ListSkewHitsinTrack[i][j]=TemporarySkewList[j][0];
1338  tmpS[j+nSciTilHitsinTrack[i]]=S[j],
1339  tmpZ[j+nSciTilHitsinTrack[i]]=Z[j],
1340  tmpZDrift[j+nSciTilHitsinTrack[i]]=ZDrift[j],
1341  // error is intentionally overestimated for later use in SZ fit.
1342  tmpErrorZDrift[j+nSciTilHitsinTrack[i]] = 3.*STRAWRADIUS;
1343  }
1344 
1345 
1346  if( nSttSkewhitinTrack[i]+nSciTilHitsinTrack[i]< 2) {
1347  for(j=0;j<nSttSkewhitinTrack[i];j++){
1348  Sfinal[i][infoskew[ ListSkewHitsinTrack[i][j] ]]= S[j];
1349  }
1350  continue ;
1351  }
1352 
1353 // finding if there are discontinuity at 0 for fi value of the Skew Straws Hit.
1354 // In case of discontinuity at 0, add 2*PI to fi of those hits with fi in the 1st quadrant.
1355 // This is necessary because the discontinuities would make the fit
1356 // in the SZ plane fail.
1357 // In this discontinuity fixing, the value FI0 of the vertex (0,0) is also included.
1358 // If there is discontinuity fixing, the values of S[i] AND POSSIBLY
1359 // Fi_initial_helix_referenceframe[i] might be modified (+2.*PI) from now on.
1360 
1361 
1363  nSttSkewhitinTrack[i],
1364  S,
1365  &Fi_initial_helix_referenceframe[i],
1366  Charge[i]
1367  );
1368 
1369 
1370 
1371  Status[i] = FitSZspace(
1372  nSttSkewhitinTrack[i]+nSciTilHitsinTrack[i],
1373  tmpS,
1374  tmpZ,
1375  tmpZDrift, // drift radius onto the SZ projection; if negative --> SciTil hit.
1376  tmpErrorZDrift,
1377  Fi_initial_helix_referenceframe[i], // this is an input;
1378  NHITSINFIT, // maximum n. hits in fit.
1379  &KAPPA[i]
1380  );
1381 // Status[i] is negative (-99) when m = 0. and (-100) as result when the fit with glpk
1382 // failed.
1383 
1384 
1385  if(Status[i] < 0 || fabs(KAPPA[i])>1.e10) {
1386  // necessary to load here the Sfinal vector anyway.
1387  for(j=0;j<nSttSkewhitinTrack[i];j++){
1388  Sfinal[i][infoskew[ListSkewHitsinTrack[i][j]]]= S[j];
1389  }
1390  continue;
1391  }
1392 
1393  FI0[i]=Fi_initial_helix_referenceframe[i]; // therefore, FI0[i] has an extra +2*PI or -2*PI added
1394  // in case of tracks
1395  // crossing the X axis
1396 
1397 
1398 
1399 //----- finding a better association of the skew hits intersecting this XY trajectory circle
1400 
1401 // this means discarding those skew hits that are too far away from the fitted straight line
1402 // found in the SZ fit.
1403 
1404 
1406  nSttSkewhitinTrack[i],
1407  TemporarySkewList, // input, list of selected skew hits (in skew numbering)
1408  S, // input, S coordinate of selected Skew hit
1409  Z, // input, Z coordinate of center wire of selected Skew hit
1410  ZDrift, // input, drift distance IN Z DIRECTION only, of selected Skew hit
1411  ZErrorafterTilt, // input, Radius taking into account the tilt,
1412  // IN Z DIRECTION only, of selected Skew hit
1413  KAPPA[i], // input, KAPPA result of fit
1414  FI0[i], // input, FI0 result of fit,
1415  tempore, // output, associated skew hits
1416  temporeS, // output, associated skew hit S
1417  temporeZ, // output, associated skew hits Zcoordinate of center wire
1418  temporeZDrift, // output, associated skew hit Z drift
1419  temporeZErrorafterTilt, // output, associated skew hits Z error after tilt
1420  &STATUS // output
1421  );
1422 // out of this function STATUS is zero signals only that KAPPA is zero.
1423 
1424 
1425 
1426 
1427  if( STATUS >=0 ){
1428 
1429  nSttSkewhitinTrack[i] = NNN;
1430  // limit the total # of hits in track to nmaxHitsInTrack.
1431  if( nSttSkewhitinTrack[i]+nHitsinTrack[i] > nmaxHitsInTrack ) {
1432  if(nmaxHitsInTrack-nHitsinTrack[i]>0)nSttSkewhitinTrack[i]=nmaxHitsInTrack-nHitsinTrack[i];
1433  else nSttSkewhitinTrack[i]=0;
1434  }
1435  for(j=0;j<nSttSkewhitinTrack[i];j++){
1436  ListSkewHitsinTrack[i][j]=tempore[j];
1437  Sfinal[i][infoskew[ListSkewHitsinTrack[i][j]]]= temporeS[j];
1438  S[j] = temporeS[j] ;
1439  Z[j] = temporeZ[j] ;
1440  ZDrift[j] = temporeZDrift[j] ;
1441  ZErrorafterTilt[j] = temporeZErrorafterTilt[j] ;
1442  }
1443 
1444  if (NNN < 2) continue ;
1445 
1446  GoodSkewFit[i]= true;
1447 
1448  } else { // continuation of if( STATUS >=0 )
1449 
1450  nSttSkewhitinTrack[i]=TemporarynSttSkewhitinTrack;
1451  // limit the total # of hits in track to nmaxHitsInTrack.
1452  if( nSttSkewhitinTrack[i]+nHitsinTrack[i] > nmaxHitsInTrack ) {
1453  if(nmaxHitsInTrack-nHitsinTrack[i]>0)nSttSkewhitinTrack[i]=nmaxHitsInTrack-nHitsinTrack[i];
1454  else nSttSkewhitinTrack[i]=0;
1455  }
1456  for(j=0;j<nSttSkewhitinTrack[i];j++){ ListSkewHitsinTrack[i][j]=TemporarySkewList[j][0];}
1457  GoodSkewFit[i]= true;
1458  } // end of if( STATUS >=0 )
1459 
1460 
1461  if( nHitsinTrack[i]+nSttSkewhitinTrack[i] < MINIMUMHITSPERTRACK ||
1462  nHitsinTrack[i]+nSttSkewhitinTrack[i]>nmaxHitsInTrack) {
1463  keepit[i]=false;
1464  continue;
1465  }
1466 
1467 
1468 
1469  // --------- numbering according to the ORIGINAL hit number
1470  for(i1=0; i1< nSttSkewhitinTrack[i]; i1++){
1471  Sfinal[i][ infoskew[ ListSkewHitsinTrack[i][i1] ] ] = S[i1] ;
1472  Zfinal[i][ infoskew[ ListSkewHitsinTrack[i][i1] ] ] = Z[i1] ;
1473  ZDriftfinal[i][ infoskew[ ListSkewHitsinTrack[i][i1] ] ] = ZDrift[i1] ;
1474  ZErrorafterTiltfinal[i][ infoskew[ ListSkewHitsinTrack[i][i1] ] ] = ZErrorafterTilt[i1] ;
1475  }
1476  // ---------
1477 
1478 
1479 // -------------------------------------------------------------
1480 
1481 
1482 
1483  } // end of for(i=0; i<nTracksFoundSoFar;i++)
1484 //------------------------------------------------------ end of skew hits section
1485 
1486 
1487 // now the ordering the parallel and skew hits.
1488 
1489 
1490  for(i=0; i<nTracksFoundSoFar;i++){
1491  nTotalHits[i] = nHitsinTrack[i]+nSttSkewhitinTrack[i];
1492 
1493  // the BigList array must be loaded also when there are no Skew hits.
1495  infoparal,
1496  infoskew,
1497  Ox[i],
1498  Oy[i],
1499  R[i],
1500  nSttSkewhitinTrack[i], // input
1501  &ListSkewHitsinTrack[i][0],// input, but this gets ordered
1502  &Sfinal[i][0], // input from Skew Straws
1503  Charge[i], // input
1504  nHitsinTrack[i], // input, # parallel Hits in the current track
1505  &ListHitsinTrack[i][0], // this was already ordered
1506  &U[i][0], // U conformal parallel hits; input, this was already ordered
1507  &V[i][0], // V conformal parallel hits; input, this was already ordered
1508  &BigList[i][0] // this is the final ordered Parallel+Skew list; already
1509  // in NATIVE hit number.
1510  );
1511 
1512 
1513 // if ( nSttSkewhitinTrack[i]==0) continue;
1514 
1515 
1516 if(istampa>=2)
1517 {
1518  cout<<"Evt. n. "<<IVOLTE<<", Traccia n. "<<i<<", list dei "<<nTotalHits[i]
1519  <<" hits come stanno in BigList (original notation) :\n";
1520 
1521  for(int ig=0;ig<nTotalHits[i];ig++){
1522  cout<<" hit n. "<<BigList[i][ig] <<endl;
1523  }
1524  cout<<"e ora gli skew hits ordinati (original notation) :\n";
1525  for(int ig=0;ig<nSttSkewhitinTrack[i];ig++){
1526  cout<<" hit n. "<<infoskew[ListSkewHitsinTrack[i][ig]] <<endl;
1527  }
1528 }
1529 
1530 
1531  } // end of for(i=0; i<nTracksFoundSoFar;i++)
1532 
1533 
1534 
1535 
1536 //-----------------------------------
1537 
1538  for(i=0; i<nTracksFoundSoFar;i++){
1539 
1540 
1541 
1542 //--------stampe.
1543 if(istampa>=2){cout<<"\tPndSttTrackFinderReal, fine di procedura, IVOLTE = "
1544  <<IVOLTE<<", traccia n. "<<i<<", lista degli hit || :"<<endl;
1545  for(int ic=0;ic<nHitsinTrack[i];ic++){
1546  cout<<"\thit || (nativo) n. "<<infoparal[ ListHitsinTrack[i][ic] ]<<endl;
1547  }
1548  cout<<"\tlista degli Stt // hits :"<<endl;
1549  for(int ic=0;ic<nSciTilHitsinTrack[i];ic++){
1550  cout<<"\thit // Stt (nativo) n. "<<infoskew[ ListSkewHitsinTrack[i][ic] ]
1551  <<endl;
1552  }
1553 
1554  cout<<"\tlista degli hit SciTil :"<<endl;
1555  for(int ic=0;ic<nSciTilHitsinTrack[i];ic++){
1556  cout<<"\thit SciTil n. "<<ListSciTilHitsinTrack[i][ic]<<
1557  ", Z "<<posizSciTil[ ListSciTilHitsinTrack[i][ic] ][2]<<
1558  ", S "<<S_SciTilHitsinTrack[i][ic]<<
1559  endl;
1560  }
1561 }
1562 //-------------- fine stampe.
1563 
1564  } // end of for(i=0; i<nTracksFoundSoFar;i++)
1565 
1566 //-------------------- inizio della sezione sul confronto tra MC truth e tracce trovate
1567 
1568 // associate the tracks found with Pattern Recognition to the MC tracks
1569 
1570  for(int ig=0;ig<nTracksFoundSoFar;ig++){
1571  daTrackFoundaTrackMC[ig]=-1; // inizialization for protection agains possible
1572  // weird values; this is necessary because later
1573  // this is used in the PndTrackCand array.
1574  }
1575 
1576 
1577  if( nMCTracks >0 && nTracksFoundSoFar > 0 && doMcComparison ) {
1578 
1579 
1581  keepit,
1582  info,
1583  nTracksFoundSoFar,
1584  nHitsinTrack,
1585  ListHitsinTrack,
1586  nSttSkewhitinTrack,
1587  ListSkewHitsinTrack,
1588  daTrackFoundaTrackMC
1589  );
1590 
1591 
1592  for(jexp=0; jexp<nTracksFoundSoFar;jexp++){
1593  if(!keepit[jexp]) continue;
1594  nParalCommon[jexp]=0;
1595  nSkewCommon[jexp]=0;
1596  nMCParalAlone[jexp]=0;
1597  nMCSkewAlone[jexp]=0;
1598  nSpuriParinTrack[jexp]=0;
1599  nSpuriSkewinTrack[jexp]=0;
1600 
1601 // --- parallel hits
1602 
1603  for(exphit=0; exphit<nHitsinTrack[jexp]; exphit++){
1604  iHit = infoparal[ ListHitsinTrack[jexp][exphit] ];
1605  enne[jexp][exphit] = (Short_t) ( info[iHit][6] + 0.01);
1606  if( enne[jexp][exphit] == daTrackFoundaTrackMC[jexp] ){
1607  ParalCommonList[jexp][ nParalCommon[jexp] ] = iHit;
1608  nParalCommon[jexp]++;
1609  } else {
1610  ParSpuriList[jexp][ nSpuriParinTrack[jexp] ] = iHit;
1611  nSpuriParinTrack[jexp]++;
1612  }
1613 
1614  }
1615 //--- ricerca degli hits non mecciati, della traccia MC associata a questa traccia trovata.
1616  for(i=0; i<Minclinations[0]; i++){
1617  if( !InclusionListbis[ infoparal[i] ] ) continue;
1618  emme = (Short_t) ( info[ infoparal[i] ][6] + 0.01);
1619  if( emme == daTrackFoundaTrackMC[jexp] ){
1620  flaggo=true;
1621  for(exphit=0; exphit<nHitsinTrack[jexp]; exphit++){
1622  if(ListHitsinTrack[jexp][exphit] == i){
1623  flaggo=false;
1624  break;
1625  }
1626  }
1627  if(flaggo){
1628  MCParalAloneList[jexp][ nMCParalAlone[jexp] ] = infoparal[i];
1629  nMCParalAlone[jexp]++;
1630  }
1631  }
1632  } // end of for(i=0; i<Minclinations[0]; i++)
1633 
1634  nHitsInMCTrack[jexp] = nMCParalAlone[jexp]+nParalCommon[jexp];
1635 // --- skew hits
1636 
1637  for(exphit=0; exphit<nSttSkewhitinTrack[jexp]; exphit++){
1638  iHit = infoskew[ ListSkewHitsinTrack[jexp][exphit] ];
1639  enne[jexp][exphit] = (Short_t) ( info[iHit][6] + 0.01);
1640  if( enne[jexp][exphit] == daTrackFoundaTrackMC[jexp] ){
1641  SkewCommonList[jexp][ nSkewCommon[jexp] ] = iHit;
1642  nSkewCommon[jexp]++;
1643  } else {
1644  SkewSpuriList[jexp][ nSpuriSkewinTrack[jexp] ] = iHit;
1645  nSpuriSkewinTrack[jexp]++;
1646  }
1647 
1648  }
1649 
1650 //--- ricerca degli hits non mecciati, della traccia MC associata a questa traccia trovata.
1651  for(i=0; i<nSttSkewhit; i++){
1652  if( !InclusionListSkewbis[ infoskew[i] ] ) continue;
1653  emme = (Short_t) ( info[ infoskew[i] ][6] + 0.01);
1654  if( emme == daTrackFoundaTrackMC[jexp] ){
1655  flaggo=true;
1656  for(exphit=0; exphit<nSttSkewhitinTrack[jexp]; exphit++){
1657  if(i == ListSkewHitsinTrack[jexp][exphit]){
1658  flaggo=false;
1659  break;
1660  }
1661  }
1662  if(flaggo){
1663  MCSkewAloneList[jexp][ nMCSkewAlone[jexp] ] = infoskew[i];
1664  nMCSkewAlone[jexp]++;
1665  }
1666  }
1667  }
1668 
1669  nSttSkewhitInMCTrack[jexp] = nMCSkewAlone[jexp]+nSkewCommon[jexp];
1670 
1671 
1672  } // end of for(jexp=0; jexp<nTracksFoundSoFar;jexp++)
1673 
1674 
1675 
1676 
1677 
1678 
1679 
1680 //---------- conteggio delle tracce MC accettabili!!
1681 int citata;
1682 int nMCTracksaccettabili=0;
1683 int ListaMCTracksaccettabili[nMCTracks];
1684 for (i=0;i<nMCTracks;i++){
1685  citata=0;
1686  pMCtr = (PndMCTrack*) fMCTrackArray->At(i);
1687  if ( ! pMCtr ) continue;
1688  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Pxx, Pyy ;
1689  Int_t icode;
1690  icode = pMCtr->GetPdgCode() ; // PDG code of track
1691  Oxx = pMCtr->GetStartVertex().X(); // X of starting point track
1692  Oyy = pMCtr->GetStartVertex().Y(); // Y of starting point track
1693  Pxx = pMCtr->GetMomentum().X();
1694  Pyy = pMCtr->GetMomentum().Y();
1695  aaa = sqrt( Pxx*Pxx + Pyy*Pyy);
1696  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
1697 
1698  if(istampa>2){
1699  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
1700  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
1701  if (icode>1000000000) carica = 1.;
1702  else carica = fParticle->Charge()/3. ; // charge of track
1703  if(fabs(carica)<1.e-5) continue;
1704  Cx = Oxx + Pyy*1000./(BFIELD*CVEL*carica);
1705  Cy = Oyy - Pxx*1000./(BFIELD*CVEL*carica);
1706  cout<<"da PndSttTrackFinderReal, evento (cominciando da 0) n. "<<IVOLTE<<
1707  ", traccia MC n. "<<i<<", R MC = "<<Rr<<", Centro X = "<<Cx
1708  <<", Centro Y = "<<Cy<<endl;
1709  }
1710 
1711  for(int ic=0;ic<Nhits;ic++){
1712  if( ( (int) (info[ic][6]+0.1) ) == i && info[ic][5]<2.){
1713  citata++;
1714  }
1715  }
1716  if( citata>2 && fabs(Oxx)<1. && fabs(Oyy) < 1. ) {
1717  ListaMCTracksaccettabili[nMCTracksaccettabili]=i;
1718  nMCTracksaccettabili++;
1719  }
1720 
1721 
1722 }
1723 
1724 if(istampa>=1){cout<<"da PndSttTrackFinderReal, MC comparison; evt. "<<IVOLTE<<", nMCTracks "<<nMCTracks
1725 <<", n. MC tracce accettabili "<<nMCTracksaccettabili
1726 <<" e loro lista :\n";
1727  for(int g=0; g<nMCTracksaccettabili;g++){
1728  cout<<"\ttraccia MC n. "<<ListaMCTracksaccettabili[g]<<endl;
1729  }
1730 cout<<"Total track trovate "<<nTracksFoundSoFar<<endl;
1731 }
1732 
1733 //----------- fine conteggio delle tracce MC accettabili
1734 
1735 
1736 
1737 
1738 
1739 //----------------
1740  if(istampa>=1 ){
1741  fprintf(HANDLE, "\n Evento %d NTotaleTracceMC %d ------\n",
1742  IVOLTE, nMCTracksaccettabili);
1743  int ibene=0;
1744  if(nMCTracksaccettabili>0){
1745  for(ii=0; ii<nTracksFoundSoFar;ii++){
1746  // il controllo su keepit e' gia' incluso in daTrackFoundaTrackMC
1747  // (che in tal caso e' -1).
1748  // GoodSkewFit invece non c'entra, perche' daTrackFoundaTrackMC
1749  // e' caricata in funzione degli hit paralleli solamente.
1750  for(i=0;i<nMCTracksaccettabili;i++){
1751  if( daTrackFoundaTrackMC[ii]==ListaMCTracksaccettabili[i]){
1752  ibene++;
1753  }
1754  }
1755  }
1756  }
1757  if(ibene>0) fprintf(HANDLE,"\tn. volte almeno 1 traccia MC accettabile e' ricostruita %d\n"
1758  ,ibene);
1759  }// end of if(istampa>=1 )
1760 //----------------
1761 
1762 
1763 
1764 
1765 for (ii=0; ii<nTracksFoundSoFar && istampa>=1 ;ii++){
1766  if(!keepit[ii]) continue;
1767  fprintf(HANDLE,"----------------------------------------------------------\n");
1768  i=daTrackFoundaTrackMC[ii];
1769 
1770  if( i <0 ) {
1771  fprintf(HANDLE,
1772 " No TracciaMC associated to found track n. %d in pattern recognition, with %d Hits ||, %d skew hits, %f Radius \n "
1773  ,ii,nHitsinTrack[ii], nSttSkewhitinTrack[ii], R[ii] );
1774  continue;
1775  }
1776  if( ! ( GoodSkewFit[ii] ) ) {
1777  fprintf(HANDLE,
1778 " TracciaMC %d; sua FoundTrack associata (n. %d) NONsoddisfaRequisitiMinimi perche' in Z-S KAPPA e' risultata || asse S\n",i,ii);
1779  continue;
1780  }
1781  if(fabs(KAPPA[ii])<1.e-10 ){
1782  fprintf(HANDLE,
1783 " TracciaMC %d; sua FoundTrack associata (n. %d) NONsoddisfaRequisitiMinimi perche' KAPPA troppo piccolo; KAPPA = %g\n",
1784  i,ii,KAPPA[ii]);
1785  continue;
1786 // } else if (fabs(KAPPA[ii])>1.e-10 ){
1787 // fprintf(HANDLE,
1788 //" TracciaMC %d; sua FoundTrack associata (n. %d) NONsoddisfaRequisitiMinimi perche' KAPPA troppo grande; KAPPA = %g\n",
1789 // i,ii,KAPPA[ii]);
1790 // continue;
1791  }
1792  Double_t dista=sqrt( Ox[ii]*Ox[ii]+Oy[ii]*Oy[ii] );
1793  if(fabs(dista)<1.e-20 ){
1794  fprintf(HANDLE,
1795 " TracciaMC %d; sua FoundTrack associata (n. %d) NONsoddisfaRequisitiMinimi perche' centro Helix Cilinder trovato dista solo %g da (0,0)\n",
1796  i,ii,dista);
1797  continue;
1798  }
1799  pMCtr = (PndMCTrack*) fMCTrackArray->At(i);
1800  if ( ! pMCtr ){
1801  fprintf(HANDLE,
1802  " MC track n. %d doesn't have pointer to MC Track TClones Array\n",
1803  i);
1804  continue;
1805  }
1806 
1807 // controllo che la traccia associata MC sia una delle tracce MC 'ragionevoli'.
1808 
1809  flaggo=true;
1810  for(int g=0; g<nMCTracksaccettabili;g++){
1811  if( i==ListaMCTracksaccettabili[g]){
1812  flaggo=false;
1813  break;
1814  }
1815  }
1816  if(flaggo) continue;
1817 
1818 
1819  fprintf(HANDLE,
1820 " TracciaMC %d ParHitsMC %d ParMecc %d ParMeccSpuri %d SkewHitsMC %d SkewMecc %d SkewMeccSpuri %d\n",
1821  i,
1822  nHitsInMCTrack[ii],
1823  nParalCommon[ii],
1824  nSpuriParinTrack[ii],
1826  nSkewCommon[ii],
1827  nSpuriSkewinTrack[ii]
1828 
1829  ) ;
1830  fprintf(HANDLE,
1831 " e corrisponde a track found n. %d\n", ii );
1832  fprintf(HANDLE,
1833 " AVENDO %d hits paralleli e %d hits skew non mecciati dalla corrisponde track found\n"
1834  , nMCParalAlone[ii],nMCSkewAlone[ii] );
1835 
1836  HoughFi = atan2(Oy[ii],Ox[ii]);
1837  if(HoughFi<0.) HoughFi += 2.*PI;
1838 
1839  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy ;
1840  Int_t icode;
1841  icode = pMCtr->GetPdgCode() ; // PDG code of track
1842  Oxx = pMCtr->GetStartVertex().X(); // X of starting point track
1843  Oyy = pMCtr->GetStartVertex().Y(); // Y of starting point track
1844  Px = pMCtr->GetMomentum().X();
1845  Py = pMCtr->GetMomentum().Y();
1846  aaa = sqrt( Px*Px + Py*Py);
1847  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
1848  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
1849  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
1850  if (icode>1000000000) carica = 1.;
1851  else carica = fParticle->Charge()/3. ; // charge of track
1852  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
1853  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
1854  Fifi = atan2(Cy, Cx); // MC truth Fifi angle of circle of Helix trajectory
1855  if(Fifi<0.) Fifi += 2.*PI;
1856  Double_t Kakka ;
1857  if( fabs( pMCtr->GetMomentum().Z() )< 1.e-20) Kakka = 99999999.;
1858  else Kakka = -carica*0.001*BFIELD*CVEL/pMCtr->GetMomentum().Z();
1859 
1860  fprintf(HANDLE,
1861 " R_MC %g R %g Fi_MC %g Fi %g KAPPA_MC %g KAPPA %g FI0_MC %g FI0 %g\n",
1862  Rr,
1863  R[ ii ],
1864  Fifi,
1865  HoughFi,
1866  Kakka,
1867  KAPPA[ ii ],
1868  fmod(Fifi+ PI, 2.*PI), // FI0 da MC truth
1869  FI0[ ii ]
1870  );
1871 
1872 
1873  } // end of for (ii=0; ii<nTracksFoundSoFar && istampa>=2 ;ii++)
1874 
1875 
1876 //--------------ghosts
1877 
1878 // fa il conto delle ghost solo sugli eventi che hanno almeno 1 traccia MC accettabile.
1879 int NParghost=0, NParhitsghost=0,icc;
1880 if( istampa>=1 && nMCTracksaccettabili>0 ){
1881  for(icc=0; icc<nTracksFoundSoFar;icc++){
1882  if(!keepit[icc]) continue;
1883  if( daTrackFoundaTrackMC[icc] == -1){
1884  NParghost++;
1885  NParhitsghost += nHitsinTrack[icc]+nSttSkewhitinTrack[icc];
1886 
1887  fprintf(HANDLE," tracce Trovata n. %d e' Ghost\n",icc);
1888  }
1889  }
1890  fprintf(HANDLE,
1891 " tracceGhostTrovate %d TotaleHitsGhost %d ----\n",
1892  NParghost,
1893  NParhitsghost
1894  );
1895 
1896  fprintf(HANDLE,"----------------------------------------------------------\n");
1897 
1898 } // end of if( istampa>=2)
1899 
1900 
1901 
1902  } // end of if( nMCTracks >0 && nTracksFoundSoFar > 0 && doMcComparison )
1903 
1904 //-------------------- fine della sezione sul confronto tra MC truth e tracce trovate
1905 
1906 
1907 
1908 
1909 
1910 //----------------------------------------------------------------------------------
1911 // loading the hits found and associated to a track in a PndTrackCand class;
1912 // a class per each track
1913 
1914  int ipinco=0, ipanco=0;
1915  Int_t flag;
1916  Double_t Ptras,Pxini,Pyini,Pzini,dista, qop;
1917  PndTrackCand *pTrckCand;
1918  PndTrack* pTrck;
1919  TVector3 Momentum,ErrMomentum,Position,ErrPosition;
1920  for(i=0; i<nTracksFoundSoFar;i++){
1921  if(!keepit[i]) continue;
1922  dista=sqrt( Ox[i]*Ox[i]+Oy[i]*Oy[i] );
1923  Ptras = R[i]*0.003*BFIELD;
1924  Pxini = -Charge[i]*Ptras*Oy[i]/dista;
1925  Pyini = Charge[i]*Ptras*Ox[i]/dista;
1926  TVector3 posSeed(0.,0.,0.); // the starting point of the trajectory
1927 
1928  if( GoodSkewFit[i] ) {
1929  new((*trackCandArray)[ipinco]) PndTrackCand;
1930  pTrckCand = (PndTrackCand*) trackCandArray->At(ipinco);
1931 
1932  if(fabs(KAPPA[i])>1.e-20 ){
1933  Pzini = -Charge[i]*0.003*BFIELD/KAPPA[i];
1934  // PMAX is the maximum Pz tolerable; it is set at 100 for now.
1935  if(fabs(Pzini) < PMAX) flag =0 ; else flag=-1;
1936  TVector3 dirSeed(Pxini,
1937  Pyini,
1938  Pzini); // momentum direction in starting point
1939  qop = Charge[i]/dirSeed.Mag();
1940  dirSeed.SetMag(1.);
1941  pTrckCand->setTrackSeed(posSeed, dirSeed, qop);
1942  if(doMcComparison){
1943  pTrckCand->setMcTrackId( daTrackFoundaTrackMC[i] );
1944  } else {
1945  pTrckCand->setMcTrackId(-1);
1946  }
1947  for(j=0; j< nTotalHits[i]; j++){
1948  pTrckCand->AddHit(
1949  FairRootManager::Instance()->GetBranchId(fSttBranch),
1950  (Int_t) BigList[i][j] , j);
1951  }
1952 
1953  // add the SciTil hit(s).
1954  if(nSciTilHitsinTrack[i]>0){
1955  for(j=0; j< nSciTilHitsinTrack[i]; j++){
1956  pTrckCand->AddHit(
1957  1001,// my personal hit type for SciTil.
1958  (Int_t) ListSciTilHitsinTrack[i][j] , nTotalHits[i]+j);
1959  }
1960  }
1961 
1962 
1963  //-------- do relevant calculation for this track and load the PndTrack class
1964  //---- first hit
1965  if(fabs(info[ BigList[i][0] ][5] -1.)< 1.e-10 ) {// it is a parallel straw
1967  info,
1968  BigList[i][0],
1969  Ox[i],
1970  Oy[i],
1971  R[i],
1972  KAPPA[i],
1973  FI0[i],
1974  Charge[i],
1975  Posiz1
1976  );
1977  } else { // it is a skew straw
1979  Zfinal[i][ BigList[i][0] ], // Z coordinate of selected Skew hit
1980  ZDriftfinal[i][ BigList[i][0] ], // drift distance IN Z DIRECTION only, of Skew hit
1981  Sfinal[i][ BigList[i][0] ],
1982  Ox[i],
1983  Oy[i],
1984  R[i],
1985  KAPPA[i],
1986  FI0[i],
1987  Charge[i],
1988  Posiz1
1989  );
1990  }
1991  // if all X, Y, Z positions were found for the first hit, go on
1992  if( Posiz1[0] > -777777776. )
1993  {
1994  //---- last hit
1995  if(fabs(info[ BigList[i][nTotalHits[i]-1] ][5] -1.)< 1.e-10 ) {// it is a parallel straw
1997  info,
1998  BigList[i][nTotalHits[i]-1],
1999  Ox[i],
2000  Oy[i],
2001  R[i],
2002  KAPPA[i],
2003  FI0[i],
2004  Charge[i],
2005  Posiz2
2006  );
2007  } else { // it is a skew straw
2009  Zfinal[i][ BigList[i][nTotalHits[i]-1] ], // Z coordinate of selected Skew hit
2010  ZDriftfinal[i][ BigList[i][nTotalHits[i]-1] ], // drift distance IN Z DIRECTION only, of Skew hit
2011  Sfinal[i][ BigList[i][nTotalHits[i]-1] ],
2012  Ox[i],
2013  Oy[i],
2014  R[i],
2015  KAPPA[i],
2016  FI0[i],
2017  Charge[i],
2018  Posiz2
2019  );
2020  }
2021  if( Posiz2[0] > -777777776. )
2022  {
2023 
2024  // load in FairTrackParP first the relevant quantities
2025  // of the first hit
2026  Position.SetX( Posiz1[0] );
2027  Position.SetY( Posiz1[1] );
2028  Position.SetZ( Posiz1[2] );
2029  ErrPosition.SetX(0.02); // 200 microns
2030  ErrPosition.SetY(0.02); // 200 microns
2031  ErrPosition.SetZ(1.); // 1 cm
2032  // calculate Px and Py
2033  versor[0] = Ox[i]-Posiz1[0];
2034  versor[1] = Oy[i]-Posiz1[1];
2035  Distance = sqrt(versor[0]*versor[0]+versor[1]*versor[1]);
2036  // I already know from PndSttInfoXYZ... that versor is not zero.
2037  versor[0] /= Distance;
2038  versor[1] /= Distance;
2039  Px = -Charge[i]*Ptras*versor[1];
2040  Py = Charge[i]*Ptras*versor[0];
2041  Momentum.SetX(Px);
2042  Momentum.SetY(Py);
2043  Momentum.SetZ(Pzini);
2044  ErrMomentum.SetX(0.05*Ptras); // set at 5% all the times.
2045  ErrMomentum.SetY(0.05*Ptras); // set at 5% all the times.
2046  ErrMomentum.SetZ(0.05*Pzini); // set at 5% all the times.
2047  // the plane of this FairTrackParP better is perpendicular to
2048  // the momentum direction
2049  ddd = Ptras*sqrt(Ptras*Ptras+Pzini*Pzini);
2050  FairTrackParP first( Position, Momentum,
2051  ErrPosition, ErrMomentum, Charge[i],
2052  Position, TVector3(Py/Ptras, -Px/Ptras, 0.),
2053  TVector3(Pzini*Px/ddd,Pzini*Py/ddd, -Ptras*Ptras/ddd)
2054  );
2055  // load in FairTrackParP first the relevant quantities
2056  // of the last hit
2057  Position.SetX( Posiz2[0] );
2058  Position.SetY( Posiz2[1] );
2059  Position.SetZ( Posiz2[2] );
2060  ErrPosition.SetX(0.02); // 200 microns
2061  ErrPosition.SetY(0.02); // 200 microns
2062  ErrPosition.SetZ(1.); // 1 cm
2063  // calculate Px and Py
2064  versor[0] = Ox[i]-Posiz2[0];
2065  versor[1] = Oy[i]-Posiz2[1];
2066  Distance = sqrt(versor[0]*versor[0]+versor[1]*versor[1]);
2067  // I already know from PndSttInfoXYZ... that versor is not zero.
2068  versor[0] /= Distance;
2069  versor[1] /= Distance;
2070  Px = -Charge[i]*Ptras*versor[1];
2071  Py = Charge[i]*Ptras*versor[0];
2072  Momentum.SetX(Px);
2073  Momentum.SetY(Py);
2074  // Momentum.SetZ(Pzini);
2075  ErrMomentum.SetX(0.05*Ptras); // set at 5% all the times.
2076  ErrMomentum.SetY(0.05*Ptras); // set at 5% all the times.
2077  // ErrMomentum.SetZ(0.05*Pzini); // set at 5% all the times.
2078  // the plane of this FairTrackParP better is perpendicular to
2079  // the momentum direction
2080  FairTrackParP last( Position, Momentum,
2081  ErrPosition, ErrMomentum, Charge[i],
2082  Position, TVector3(Py/Ptras, -Px/Ptras, 0.),
2083  TVector3(Pzini*Px/ddd,Pzini*Py/ddd, -Ptras*Ptras/ddd)
2084  );
2085  //-------- load PndTrack object
2086  pTrck = new((*trackArray)[ipanco]) PndTrack(first, last, *pTrckCand);
2087  pTrck->SetRefIndex(ipanco);
2088  pTrck->SetFlag(flag); // at this point flag = 0 for Pz<PMAX, -1 otherwise.
2089  ipanco++;
2090 
2091  } else { // continuation of if( Posiz2[0]>-777777776.)
2092  //case of something wrong with last hit
2093  FairTrackParP first(
2094  TVector3(-99999., -99999., -99999.), // dummy Position
2095  TVector3(-99999., -99999., -99999.), // dummy Momentum
2096  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2097  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2098  0, // dummy Charge
2099  TVector3(-99999., -99999., -99999.), // dummy Position again
2100  TVector3(1., 0., 0.), // dummy direction versor
2101  TVector3(0., 1., 0.) // dummy direction versor
2102  );
2103  FairTrackParP last(
2104  TVector3(-99999., -99999., -99999.), // dummy Position
2105  TVector3(-99999., -99999., -99999.), // dummy Momentum
2106  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2107  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2108  0, // dummy Charge
2109  TVector3(-99999., -99999., -99999.), // dummy Position again
2110  TVector3(1., 0., 0.), // dummy direction versor
2111  TVector3(0., 1., 0.) // dummy direction versor
2112  );
2113  //-------- load PndTrack object
2114  pTrck = new((*trackArray)[ipanco]) PndTrack(first, last, *pTrckCand);
2115  pTrck->SetRefIndex(ipanco);
2116  pTrck->SetFlag(-1);
2117  ipanco++;
2118 
2119  } // end of if( Posiz2[0]>-777777776. )
2120 
2121  } else { // continuation of if( Posiz1[0] > -777777776.)
2122  //case of something wrong with first hit
2123  FairTrackParP first(
2124  TVector3(-99999., -99999., -99999.), // dummy Position
2125  TVector3(-99999., -99999., -99999.), // dummy Momentum
2126  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2127  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2128  0, // dummy Charge
2129  TVector3(-99999., -99999., -99999.), // dummy Position again
2130  TVector3(1., 0., 0.), // dummy direction versor
2131  TVector3(0., 1., 0.) // dummy direction versor
2132  );
2133  FairTrackParP last(
2134  TVector3(-99999., -99999., -99999.), // dummy Position
2135  TVector3(-99999., -99999., -99999.), // dummy Momentum
2136  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2137  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2138  0, // dummy Charge
2139  TVector3(-99999., -99999., -99999.), // dummy Position again
2140  TVector3(1., 0., 0.), // dummy direction versor
2141  TVector3(0., 1., 0.) // dummy direction versor
2142  );
2143  //-------- load PndTrack object
2144  pTrck = new((*trackArray)[ipanco]) PndTrack(first, last, *pTrckCand);
2145  pTrck->SetRefIndex(ipanco);
2146  pTrck->SetFlag(-1);
2147  ipanco++;
2148  } // end of if( Posiz1[0] > -777777776.)
2149 
2150 
2151  } else { // continuation of if(fabs(KAPPA[i])>1.e-20 )
2152 
2153  Pzini = 999999.;
2154  TVector3 dirSeed(Pxini,
2155  Pyini,
2156  Pzini); // momentum direction in starting point
2157  qop = Charge[i]/dirSeed.Mag();
2158  dirSeed.SetMag(1.);
2159 
2160  pTrckCand->setTrackSeed(posSeed, dirSeed, qop);
2161  pTrckCand->setMcTrackId( daTrackFoundaTrackMC[i] );
2162  for(j=0; j< nTotalHits[i]; j++){
2163  pTrckCand->AddHit(
2164 // FairRootManager::Instance()->GetBranchId("STTHit"),
2165  FairRootManager::Instance()->GetBranchId(fSttBranch),
2166  (Int_t) BigList[i][j] , j);
2167  }
2168 
2169 
2170  // load dummy quantities in PndTrack
2171  FairTrackParP first(
2172  TVector3(-99999., -99999., -99999.), // dummy Position
2173  TVector3(-99999., -99999., -99999.), // dummy Momentum
2174  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2175  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2176  0, // dummy Charge
2177  TVector3(-99999., -99999., -99999.), // dummy Position again
2178  TVector3(1., 0., 0.), // dummy direction versor
2179  TVector3(0., 1., 0.) // dummy direction versor
2180  );
2181  FairTrackParP last(
2182  TVector3(-99999., -99999., -99999.), // dummy Position
2183  TVector3(-99999., -99999., -99999.), // dummy Momentum
2184  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2185  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2186  0, // dummy Charge
2187  TVector3(-99999., -99999., -99999.), // dummy Position again
2188  TVector3(1., 0., 0.), // dummy direction versor
2189  TVector3(0., 1., 0.) // dummy direction versor
2190  );
2191  //-------- load PndTrack object
2192  pTrck = new((*trackArray)[ipanco]) PndTrack(first, last, *pTrckCand);
2193  pTrck->SetRefIndex(ipanco);
2194  pTrck->SetFlag(-1);
2195  ipanco++;
2196 
2197 
2198 
2199  } // end of if(fabs(KAPPA[i])>1.e-20 )
2200 
2201 
2202 
2203  } else { // continuation of if( GoodSkewFit[i] ) // case in which there is no
2204  // skew hits in this track.
2205  // This fact is signalled by
2206  Pzini = 9999.;
2207  new((*trackCandArray)[ipinco]) PndTrackCand;
2208  pTrckCand = (PndTrackCand*) trackCandArray->At(ipinco);
2209  TVector3 dirSeed(Pxini,
2210  Pyini,
2211  Pzini); // momentum direction in starting point
2212  qop = Charge[i]/Ptras; // as if Pz=0
2213 
2214 
2215 // dirSeed.SetMag(1.);
2216  pTrckCand->setTrackSeed(posSeed, dirSeed, qop);
2217  pTrckCand->setMcTrackId( daTrackFoundaTrackMC[i] );
2218  for(j=0; j< nTotalHits[i]; j++){
2219 
2220  pTrckCand->AddHit(
2221 // FairRootManager::Instance()->GetBranchId("STTHit"),
2222  FairRootManager::Instance()->GetBranchId(fSttBranch),
2223  (Int_t) BigList[i][j] , j);
2224  }
2225 
2226 
2227  // load dummy quantities in PndTrack
2228  FairTrackParP first(
2229  TVector3(-99999., -99999., -99999.), // dummy Position
2230  TVector3(-99999., -99999., -99999.), // dummy Momentum
2231  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2232  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2233  0, // dummy Charge
2234  TVector3(-99999., -99999., -99999.), // dummy Position again
2235  TVector3(1., 0., 0.), // dummy direction versor
2236  TVector3(0., 1., 0.) // dummy direction versor
2237  );
2238  FairTrackParP last(
2239  TVector3(-99999., -99999., -99999.), // dummy Position
2240  TVector3(-99999., -99999., -99999.), // dummy Momentum
2241  TVector3(-99999., -99999., -99999.), // dummy ErrPosition
2242  TVector3(-99999., -99999., -99999.), // dummy ErrMomentum
2243  0, // dummy Charge
2244  TVector3(-99999., -99999., -99999.), // dummy Position again
2245  TVector3(1., 0., 0.), // dummy direction versor
2246  TVector3(0., 1., 0.) // dummy direction versor
2247  );
2248  //-------- load PndTrack object
2249  pTrck = new((*trackArray)[ipanco]) PndTrack(first, last, *pTrckCand);
2250  pTrck->SetRefIndex(ipanco);
2251  pTrck->SetFlag(-1);
2252  ipanco++;
2253 
2254 
2255 
2256  } // end of if( GoodSkewFit[i] )
2257 
2258 
2259 
2260 
2261 
2262 
2263 
2264 
2265 
2266 //--- now increment the : number of PndTrackCand counter
2267 
2268  ipinco++;
2269 
2270  } // end of for(i=0; i<nTracksFoundSoFar;i++)
2271 
2272 
2273 
2274 
2275 
2276 
2277 
2278 //--------------- printouts of comparison with MC for judging algorithm performance
2279 
2280 
2281 
2282 
2283  if( nMCTracks >0 && nTracksFoundSoFar > 0 && doMcComparison ) {
2284 
2285 
2286  for(i=0; i<nTracksFoundSoFar;i++){
2287  if(!GoodSkewFit[i]) continue;
2288  if(!keepit[i]) continue;
2289 
2290  for( j=0; j<nParalCommon[i]; j++){
2291 
2292  Posiz[0]=Posiz[1]=Posiz[2]=0.;
2294  info,
2295  ParalCommonList[i][j],
2296  Ox[i],
2297  Oy[i],
2298  R[i],
2299  KAPPA[i],
2300  FI0[i],
2301  Charge[i],
2302  Posiz // position of hit n. ParalCommonList[i][j]
2303  // in 'Parallel' hits notation.
2304  );
2305 
2306 if(istampa>=2) cout<<"PndTrackFinderReal::DoFind, paralleli, n. hits (original notation) = "<<
2307  ParalCommonList[i][j] <<
2308  ", X = "<<
2309  Posiz[0]<<
2310  ", Y = "<<
2311  Posiz[1]<<
2312  ", Z = "<<
2313  Posiz[2]<<endl;
2314 
2315 
2316 if(istampa>=2){
2317  if( info[ParalCommonList[i][j]][6]<0. ){
2318  fprintf(PHANDLEX,"Noise hit\n");
2319  fprintf(PHANDLEY,"Noise hit\n");
2320  fprintf(PHANDLEZ,"Noise hit\n");
2321  } else {
2322  fprintf(PHANDLEX,"%g\n", veritaMC[ ParalCommonList[i][j] ] [0] - Posiz[0]);
2323  fprintf(PHANDLEY,"%g\n", veritaMC[ ParalCommonList[i][j] ] [1] - Posiz[1]);
2324  fprintf(PHANDLEZ,"%g\n", veritaMC[ ParalCommonList[i][j] ] [2] - Posiz[2]);
2325  }
2326 }
2327 
2328 
2329 
2330  } // end of for( j=0; j<nParalCommon[i]; j++)
2331 
2332 
2333  for( j=0; j<nSkewCommon[i]; j++){
2334 
2336  Zfinal[i][ SkewCommonList[i][j] ], // Z coordinate of selected Skew hit
2337  ZDriftfinal[i][ SkewCommonList[i][j] ], // drift distance IN Z DIRECTION only, of Skew hit
2338  Sfinal[i][ SkewCommonList[i][j] ],
2339  Ox[i],
2340  Oy[i],
2341  R[i],
2342  KAPPA[i],
2343  FI0[i],
2344  Charge[i],
2345  Posiz
2346  );
2347 if(istampa>=2) cout<<"DoFind, skew, n. hits (original notation) = "<<
2348  SkewCommonList[i][j] <<
2349  ", X = "<<
2350  Posiz[0]<<
2351  ", Y = "<<
2352  Posiz[1]<<
2353  ", Z = "<<
2354  Posiz[2]<<endl;
2355 
2356 
2357 if(istampa>=2){
2358  if( info[SkewCommonList[i][j]][6]<0. ){
2359  fprintf(SHANDLEX,"Noise hit\n");
2360  fprintf(SHANDLEY,"Noise hit\n");
2361  fprintf(SHANDLEZ,"Noise hit\n");
2362  } else {
2363  fprintf(SHANDLEX,"%g\n", veritaMC[ SkewCommonList[i][j] ] [0] - Posiz[0]);
2364  fprintf(SHANDLEY,"%g\n", veritaMC[ SkewCommonList[i][j] ] [1] - Posiz[1]);
2365  fprintf(SHANDLEZ,"%g\n", veritaMC[ SkewCommonList[i][j] ] [2] - Posiz[2]);
2366  }
2367 }
2368 
2369  } // end of for( j=0; j<nSkewCommon[i]; j++)
2370 
2371 
2372 
2373 
2374  } // end of for(i=0; i<nTracksFoundSoFar;i++)
2375 
2376  } // end of if( nMCTracks >0 && nTracksFoundSoFar > 0 && doMcComparison )
2377 
2378 //--------------- end of printouts of comparison with MC for judging algorithm performance
2379 
2380 //---------------------------------------------------------------------------------------------------------
2381 
2382 
2383 
2384 
2385 
2386 
2387 //------------------------------------- macro di display.
2388 
2389 if(iplotta && IVOLTE <= nmassimo){
2390 
2391 
2392 
2393 //-------------------------------------------------- macro for display
2394 
2395 //------
2396 //----------------fine stampa
2398  keepit,
2399  Nhits, info, Nincl, Minclinations,
2400  inclination,
2401  nTracksFoundSoFar
2402  );
2403 
2404 //----------------------------------- end macro for display
2405 
2406 
2407  if(doMcComparison) {
2409  keepit,
2410  Nhits, info, Nincl, Minclinations,
2411  inclination,
2412  nTracksFoundSoFar
2413  );
2414 }
2415 
2416  for(i=0, ii=-1; i<nTracksFoundSoFar;i++){
2417  if(!keepit[i])continue;
2418  ii++;
2419 
2421  Ox[i], Oy[i], R[i],
2422  nHitsinTrack[i],ListHitsinTrack,
2423  info, Nincl, Minclinations, inclination,
2424  i,
2425  ii,
2426  nSciTilHitsinTrack[i],
2427  &ListSciTilHitsinTrack[i][0]
2428  );
2429 
2430  if(doMcComparison) {
2432  Ox[i], Oy[i], R[i],
2433  daTrackFoundaTrackMC[i],
2434  nHitsinTrack[i],
2435  ListHitsinTrack,
2436  info,
2437  i,
2438  ii,
2439  nSciTilHitsinTrack[i],
2440  &ListSciTilHitsinTrack[i][0],
2441  nParalCommon,
2442  ParalCommonList,
2443  nSpuriParinTrack,
2444  ParSpuriList,
2445  nMCParalAlone,
2446  MCParalAloneList
2447 
2448  );
2449  } // end of if(doMcComparison)
2450  } // end of for(i=0, ii=-1; i<nTracksFoundSoFar;i++)
2451 
2452 for(i=0,ii=-1; i<nTracksFoundSoFar;i++){
2453  if(!keepit[i]) continue;
2454  ii++;
2455  if( iplotta) {
2456 
2457 
2458  HoughR = R[i];
2459  HoughD = sqrt(Ox[i]*Ox[i]+Oy[i]*Oy[i]) -R[i];
2460  HoughFi = atan2(Oy[i],Ox[i]);
2461  if(HoughFi<0.) HoughFi += 2.*PI;
2462 
2463 // if there are SciTil hits, calculate S.
2464  Double_t ESSE[nSciTilHitsinTrack[i]],
2465  ZETA[nSciTilHitsinTrack[i]];
2466  // here nSciTilHitsinTrack[i] is up to 2.
2467  if(nSciTilHitsinTrack[i]>0){
2468  for(j=0;j<nSciTilHitsinTrack[i];j++){
2469 
2470  ESSE[j]= S_SciTilHitsinTrack[i][j];
2471  ZETA[j]= posizSciTil[ListSciTilHitsinTrack[i][j]][2];
2472  }
2473  }
2474 
2475 
2477  GoodSkewFit[i],
2478  KAPPA[i],FI0[i], HoughD, HoughFi, HoughR,
2479  info, Nincl,Minclinations,inclination,
2480  i,
2481  ii,
2482  nSttSkewhitinTrack[i],
2483  ListSkewHitsinTrack,
2484  nSciTilHitsinTrack[i],
2485  ESSE,
2486  ZETA
2487  );
2488  if(doMcComparison) {
2489  if( daTrackFoundaTrackMC[i] >= 0){
2491  GoodSkewFit[i],
2492  KAPPA[i],FI0[i], HoughD, HoughFi, HoughR,
2493  info, Nincl,Minclinations,inclination,
2494  i,
2495  ii,
2496  nSttSkewhitinTrack[i],
2497  ListSkewHitsinTrack,
2498  nSkewCommon[i],
2499  SkewCommonList,
2500  daTrackFoundaTrackMC[i],
2501  nMCSkewAlone,
2502  MCSkewAloneList,
2503  nSciTilHitsinTrack[i],
2504  ESSE,
2505  ZETA
2506  );
2507  }
2508  }
2509 
2510  } // end of if (iplotta)
2511 } // end of for(i=0; i<nTracksFoundSoFar;i++)
2512 
2513 
2514 } // end of if(iplotta && IVOLTE <= nmassimo)
2515 
2516 //------------------------------------- fine macro di display delle skew
2517 
2518 
2519 
2520 
2521 
2522 
2523 
2524 
2525  return ((Int_t )nTracksFoundSoFar );
2526 
2527 
2528  }; //------------------------------------------------- end of function PndSttTrackFinderReal::DoFind
void WriteMacroParallelAssociatedHitswithMC(Double_t Ox, Double_t Oy, Double_t R, Short_t TrackFoundaTrackMC, Short_t Nhits, Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Double_t info[][7], Short_t ifoundtrack, Int_t sequentialNTrack, Short_t nscitilhitsintrack, Short_t *listscitilhitsintrack, Short_t nParalCommon[MAXTRACKSPEREVENT], Short_t ParalCommonList[MAXTRACKSPEREVENT][nmaxHits], Short_t nSpuriParinTrack[MAXTRACKSPEREVENT], Short_t ParSpuriList[MAXTRACKSPEREVENT][nmaxHits], Short_t nMCParalAlone[MAXTRACKSPEREVENT], Short_t MCParalAloneList[MAXTRACKSPEREVENT][nmaxHits])
void SetRefIndex(TString branch, Int_t i)
Definition: PndTrack.h:41
Short_t AssociateSkewHitsToXYTrack(bool *ExclusionListSkew, Double_t Ox, Double_t Oy, Double_t R, Double_t info[][7], Double_t inclination[][3], Double_t Fi_low_limit, Double_t Fi_up_limit, Short_t Charge, Double_t Fi_initial_helix_referenceframe, Double_t Fi_final_helix_referenceframe, Short_t SkewList[nmaxHits][2], Double_t *S, Double_t *Z, Double_t *ZDrift, Double_t *ZRadiusafterTilt)
Int_t i
Definition: run_full.C:25
FairMCPoint * GetPointFromCollections(Int_t hitCounter)
Double_t GetHalfLength()
Definition: PndSttTube.cxx:99
mdtHit Position(pos)
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
void WriteMacroParallelHitsGeneral(bool *keepit, Int_t Nhits, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Short_t nTracksFoundSoFar)
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
Double_t posizSciTil[nmaxSciTilHits][3]
void setMcTrackId(int i)
Definition: PndTrackCand.h:72
TFile * g
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
cout<< "POINTs for new FwEndCap == "<< tsim-> GetEntriesFast()
static const Short_t NHITSINFIT
void PndSttFromXYtoConformal(Double_t trajectory_vertex[3], Double_t info[][7], Int_t Nparal, Double_t infoparalConformal[][5], Int_t *status)
void PndSttOrderingSkewandParallel(Short_t *Infoparal, Short_t *Infoskew, Double_t oX, Double_t oY, Double_t Rr, Short_t nSttSkewhit, Short_t *ListSkewHits, Double_t *SList, Short_t Charge, Short_t nParHits, Short_t *ListParHits, Double_t *U, Double_t *V, Short_t *BigList)
TVector3 GetPosition() const
Definition: PndSciTHit.h:64
void PndSttInfoXYZParal(Double_t info[][7], Short_t infopar, Double_t Ox, Double_t Oy, Double_t R, Double_t KAPPA, Double_t FI0, Short_t Charge, Double_t *Posiz)
static const Short_t MAXMCTRACKS
void AssociateFoundTrackstoMCbis(bool *keepit, Double_t info[][7], Short_t nTracksFoundSoFar, Short_t nHitsinTrack[MAXTRACKSPEREVENT], Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t nSttSkewhitinTrack[MAXTRACKSPEREVENT], Short_t ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t daTrackFoundaTrackMC[MAXTRACKSPEREVENT])
static const Double_t PMAX
bool FindTrackInXYProjection(Short_t iHit, Short_t nRcell, Short_t nFicell, Int_t *Minclinations, Double_t info[nmaxHits][7], bool *ExclusionList, Short_t *RConformalIndex, Short_t *FiConformalIndex, Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[MAXHITSINCELL][nRdivConformal][nFidivConformal], Short_t nTracksFoundSoFar, Short_t *nHitsinTrack, Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Double_t *trajectory_vertex, Double_t infoparalConformal[nmaxHits][5], Double_t posizSciTilx, Double_t posizSciTily, Double_t *S, Double_t *Ox, Double_t *Oy, Double_t *R, Double_t *Fi_low_limit, Double_t *Fi_up_limit, Double_t *Fi_initial_helix_referenceframe, Double_t *Fi_final_helix_referenceframe, Short_t *Charge, Double_t *U, Double_t *V)
Short_t nSttSkewhitInMCTrack[MAXTRACKSPEREVENT]
Int_t * fParticle
Definition: run_full.C:24
static const Short_t nmaxinclinationversors
static const Short_t MAXHITSINCELL
void AddHit(UInt_t detId, UInt_t hitId, Double_t rho)
Double_t GetIsochrone() const
Definition: PndSttHit.h:62
Double_t
static const Short_t nFidivConformal
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
Double_t S_SciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHits]
Int_t GetTubeID() const
Definition: PndSttHit.h:75
void PndSttInfoXYZSkew(Double_t Z, Double_t ZDrift, Double_t S, Double_t Ox, Double_t Oy, Double_t R, Double_t KAPPA, Double_t FI0, Short_t Charge, Double_t *Posiz)
static const Short_t MAXTRACKSPEREVENT
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
Short_t FitSZspace(Short_t nSkewHitsinTrack, Double_t *S, Double_t *Z, Double_t *DriftRadius, Double_t *ErrorDriftRadius, Double_t FInot, Short_t NMAX, Double_t *emme)
Double_t veritaMC[nmaxHits][3]
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
static const Double_t STRAWRADIUS
static const Short_t nmaxHitsInTrack
static const Double_t CVEL
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
PndSttHit * GetHitFromCollections(Int_t hitCounter)
Short_t nSciTilHitsinTrack[MAXTRACKSPEREVENT]
void WriteMacroParallelHitsGeneralConformalwithMC(bool *keepit, Int_t Nhits, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Short_t nTracksFoundSoFar)
void FixDiscontinuitiesFiangleinSZplane(Short_t TemporarynSttSkewhitinTrack, Double_t *S, Double_t *Fi_initial_helix_referenceframe, Short_t Charge)
void SetFlag(Int_t i)
Definition: PndTrack.h:38
double Z
Definition: anaLmdDigi.C:68
Short_t ListSciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHitsinTrack]
Short_t AssociateBetterAfterFitSkewHitsToXYTrack(Short_t TemporarynSttSkewhitinTrack, Short_t SkewList[nmaxHits][2], Double_t *S, Double_t *Z, Double_t *ZDrift, Double_t *ZRadiusafterTilt, Double_t KAPPA, Double_t FI0, Short_t *tempore, Double_t *temporeS, Double_t *temporeZ, Double_t *temporeZDrift, Double_t *temporeZErrorafterTilt, Int_t *STATUS)
void WriteMacroSkewAssociatedHits(bool goodskewfit, Double_t KAPPA, Double_t FI0, Double_t D, Double_t Fi, Double_t R, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Int_t imaxima, Int_t sequentialNTrack, Short_t nSttSkewhitinTrack, Short_t ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t nscitilhits, Double_t *ESSE, Double_t *ZETA)
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
Short_t nHitsInMCTrack[MAXTRACKSPEREVENT]
void WriteMacroSkewAssociatedHitswithMC(bool goodskewfit, Double_t KAPPA, Double_t FI0, Double_t D, Double_t Fi, Double_t R, Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Int_t imaxima, Int_t sequentialNTrack, Short_t nSttSkewhitinTrack, Short_t ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Short_t nSkewCommon, Short_t SkewCommonList[MAXTRACKSPEREVENT][nmaxHits], Short_t daTrackFoundaTrackMC, Short_t nMCSkewAlone[MAXTRACKSPEREVENT], Short_t MCSkewAloneList[MAXTRACKSPEREVENT][nmaxHits], Short_t nscitilhits, Double_t *ESSE, Double_t *ZETA)
bool InclusionListSciTil[nmaxSciTilHits]
void WriteMacroParallelAssociatedHits(Double_t Ox, Double_t Oy, Double_t R, Short_t Nhits, Short_t ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack], Double_t info[][7], Int_t Nincl, Int_t Minclinations[], Double_t inclination[][3], Short_t imaxima, Int_t sequencial, Short_t nscitilhitsintrack, Short_t *listscitilhitsintrack)
Double_t R
Definition: checkhelixhit.C:61
void PndSttBoxConformalFilling(bool ExclusionList[nmaxHits], Double_t infoparalConformal[][5], Int_t Nparal, Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t RConformalIndex[nmaxHits], Short_t FiConformalIndex[nmaxHits])
TVector3 GetWireDirection()
Definition: PndSttTube.cxx:107
static const Double_t DIMENSIONSCITIL
int status[10]
Definition: f_Init.h:28
static const Short_t nRdivConformal
Int_t PndSttTrackFinderReal::DoFind ( TClonesArray *  trackArray,
TClonesArray *  helixHitArray 
)
virtual

Abstract method DoFind. To be implemented in the concrete class. Task: Read the pixel and strip hit arrays and fill the track array, pointers to which are given as arguments Number of tracks created

Implements PndSttTrackFinder.

Definition at line 443 of file PndSttTrackFinderReal.cxx.

443 {return 0;} // CHECK da cancellare
void PndSttTrackFinderReal::FindCharge ( Double_t  oX,
Double_t  oY,
Short_t  nParallelHits,
Double_t X,
Double_t Y,
Short_t *  Charge 
)
private

Definition at line 11184 of file PndSttTrackFinderReal.cxx.

References Double_t.

Referenced by FindTrackInXYProjection().

11192 {
11193 
11194  Short_t ihit,
11195  nleft,
11196  nright;
11197 
11198  Double_t cross,
11199  disq,
11200  minl,
11201  minr;
11202 
11203 
11204  // this methods works with the hypothesis that this track comes
11205  // from (0,0)
11206 
11207  for(ihit=0, nleft=0, nright=0, minr = 9999999., minl = 9999999.; ihit<nParallelHits; ihit++){
11208  // find the Z component of the cross product between the vector from (0,0) to center of
11209  // circular trajectory [namely, (oX,oY) ] and the Position vector of the center of the
11210  // parallel Hits [namely, (x,y)].
11211 
11212  cross = oX*Y[ihit] -
11213  oY*X[ihit];
11214 
11215  // if cross >0 hits stays 'on the left' (which means clockwise to go from the origin
11216  // to the hit following the smaller path) otherwise it stays 'on the right'.
11217 
11218  if (cross>0.) {
11219  disq = X[ihit]*X[ihit]+Y[ihit]*Y[ihit];
11220  nleft++;
11221  } else {
11222  nright++;
11223  }
11224  } // end of for(ihit=0, nleft=0, nright=0;....
11225 
11226  if( nright> nleft) {
11227  *Charge = -1;
11228  } else if ( nleft > nright) {
11229  *Charge = 1;
11230  } else { // then choose according the closest hit ti the center
11231  if( minr < minl ) *Charge = -1;
11232  else *Charge = 1;
11233  }
11234 
11235 
11236 
11237 }
double Y
Definition: anaLmdDigi.C:68
Double_t
double X
Definition: anaLmdDigi.C:68
Short_t PndSttTrackFinderReal::FindIntersectionsOuterCircle ( Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Double_t  RMax,
Double_t  Xcross[2],
Double_t  Ycross[2] 
)
private

Definition at line 12867 of file PndSttTrackFinderReal.cxx.

References a, acos(), atan2(), cos(), Double_t, sin(), and sqrt().

12875 {
12876 
12877  // return -1 --> non intersection;
12878  // return 0 --> 2 intersections.
12879 
12880  Double_t a,
12881  cosFi,
12882  Fi,
12883  FI0;
12884  a = sqrt(oX*oX+oY*oY);
12885 
12886  // case with no intersections.
12887  if( a >= R + Rma || R >= a + Rma || a + R <= Rma) return -1;
12888 
12889 
12890  FI0 = atan2(-oY,-oX);
12891  cosFi = (a*a + R*R - Rma*Rma)/(2.*R*a);
12892  if(cosFi<-1.) cosFi=-1.; else if(cosFi>1.) cosFi=1.;
12893  Fi = acos(cosFi);
12894 
12895  Xcross[0] = oX + R*cos(FI0+Fi);
12896  Ycross[0] = oY + R*sin(FI0+Fi);
12897  Xcross[1] = oX + R*cos(FI0-Fi);
12898  Ycross[1] = oY + R*sin(FI0-Fi);
12899 
12900  return 0;
12901 }
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Int_t a
Definition: anaLmdDigi.C:126
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Double_t R
Definition: checkhelixhit.C:61
Short_t PndSttTrackFinderReal::FindTrackEntranceExitbiHexagon ( 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] 
)
private

Definition at line 12198 of file PndSttTrackFinderReal.cxx.

References atan2(), ChooseEntranceExit(), Double_t, and IntersectionsWithClosedPolygon().

12209 {
12210  Short_t flag;
12211  Short_t nIntersections[2];
12212  Double_t FiStart,
12213  XintersectionList[12][2], // first index =0 --> inner Hexagon, =1 --> outer.
12214  YintersectionList[12][2]; // second index : all the possible intersections
12215  // (up to 12 intersections).
12216 
12217 // finding all possible intersections with inner parallel straw region.
12218 // The inner parallel straw region is delimited by two hexagons.
12219 
12220  // flag meaning :
12221  // -2 --> track outside outer polygon;
12222  // -1 --> track contained completely within inner polygon;
12223  // 0 --> at least 1 intersection with inner polygon, at least 1 with outer polygon;
12224  // 1 --> track contained completely between the two polygons;
12225  // 2 --> track contained completely by larger polygons, with intersections in the smaller;
12226  // 3 --> track completely outsiede the small polygon with intersections in the bigger.
12227 
12228 
12230  Oxx,
12231  Oyy,
12232  Rr,
12233  ApotemaMin, // Rmin of the inner part of parallele straws,
12234  ApotemaMax,// max Apotema of the inner part of parallele straws.
12235  nIntersections,
12236  XintersectionList, // XintersectionList[..][0] --> inner polygon,
12237  // XintersectionList[..][1] --> outer polygon.
12238  YintersectionList
12239  );
12240 
12241  // IMPORTANT :
12242  // this is true because here it is assumed that the track comes from (0,0,0)
12243  // otherwise the code must be changed!
12244 
12245  if (!(flag == 0 || flag == 2)) return flag;
12246  if (flag == 2 &&nIntersections[0]<2 ){
12247  cout<<"PndSttTrackFinderReal::FindTrackEntranceExitbiHexagon,"<<
12248  " contraddiction, nIntersections[0]="<<
12249  nIntersections[0]<<"<2, returning -99!\n";
12250  return -99;
12251  }
12252 
12253 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
12254 // and the exit point (Xcross[1], Ycross[1]) of this track.
12255 
12256 //-------- the starting point of the track.
12257  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
12258 
12259  // this method selects the entrance and exit points of the trajectory among all
12260  // geometrical intersections of the circular trajectory with the straw particular
12261  // volume.
12262 
12264  Oxx,
12265  Oyy,
12266  flag,
12267  Charge,
12268  FiStart,
12269  nIntersections,
12270  XintersectionList,
12271  YintersectionList,
12272  Xcross, // output
12273  Ycross // output
12274  );
12275 
12276  return flag;
12277 
12278 }
timer Start()
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
void ChooseEntranceExit(Double_t Oxx, Double_t Oyy, Short_t flag, Short_t Charge, Double_t FiStart, Short_t nIntersections[2], Double_t XintersectionList[][2], Double_t YintersectionList[][2], Double_t Xcross[2], Double_t Ycross[2])
Short_t IntersectionsWithClosedPolygon(Double_t Ox, Double_t Oy, Double_t R, Double_t Rmi, Double_t Rma, Short_t nIntersections[2], Double_t XintersectionList[][2], Double_t YintersectionList[][2])
Short_t PndSttTrackFinderReal::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] 
)
private

Definition at line 12287 of file PndSttTrackFinderReal.cxx.

References atan2(), ChooseEntranceExitbis(), Double_t, and IntersectionsWithClosedbiHexagonLeft().

12299 {
12300  Short_t flag;
12301  Short_t nIntersections;
12302  Double_t FiStart,
12303  XintersectionList[16], // all the possible intersections
12304  YintersectionList[16]; // (up to 16 intersections).
12305 
12306 // The following is the form of the Left (looking from downstream into the beam) biHexagon
12307 // geometrical shape considered in this method :
12308 //
12309 /*
12310 
12311  /|
12312  / |
12313  / |
12314  / /
12315  / /
12316  / /
12317  / /
12318  | |
12319  | |
12320  | |
12321  | |
12322  \ \
12323  \ \
12324  \ \
12325  \ \
12326  \ |
12327  \ |
12328  \|
12329 
12330 */
12331 // finding all possible intersections with inner parallel straw region.
12332 // The inner parallel straw region is delimited by two hexagons.
12333 
12334  // flag meaning :
12335  // -1 --> track outside outer perimeter;
12336  // 0 --> at least 1 intersection with polygon, therefore a possible entry and an exit;
12337  // 1 --> track contained completely between the two polygons;
12338 
12339 
12341  vgap,
12342  Oxx,
12343  Oyy,
12344  Rr,
12345  ApotemaMin, // Apotema of the inner Hexagon,
12346  ApotemaMax,// Apotema of the outer Hexagon.
12347  &nIntersections,
12348  XintersectionList, // XintersectionList[..][0] --> inner polygon,
12349  // XintersectionList[..][1] --> outer polygon.
12350  YintersectionList
12351  );
12352 
12353  // IMPORTANT :
12354  // this is true because here it is assumed that the track comes from (0,0,0)
12355  // otherwise the code must be changed!
12356 
12357  if (!(flag == 0)) return flag;
12358  if( nIntersections<2) return -1;
12359 
12360 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
12361 // and the exit point (Xcross[1], Ycross[1]) of this track.
12362 
12363 //-------- the starting point of the track.
12364  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
12365 
12366  // this method selects the entrance and exit points of the trajectory among all
12367  // geometrical intersections of the circular trajectory with the straw particular
12368  // volume.
12369 
12370  // so at this point, the intersections are at least 2.
12371 
12373  Oxx,
12374  Oyy,
12375  Charge,
12376  FiStart,
12377  nIntersections,
12378  XintersectionList,
12379  YintersectionList,
12380  Xcross, // output
12381  Ycross // output
12382  );
12383 
12384 
12385 //----------------------
12386 
12387  return flag;
12388 
12389 }
timer Start()
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])
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Short_t IntersectionsWithClosedbiHexagonLeft(Double_t vgap, Double_t Ox, Double_t Oy, Double_t R, Double_t Ami, Double_t Ama, Short_t *nIntersections, Double_t *XintersectionList, Double_t *YintersectionList)
Short_t PndSttTrackFinderReal::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] 
)
private

Definition at line 12404 of file PndSttTrackFinderReal.cxx.

References atan2(), ChooseEntranceExitbis(), Double_t, and IntersectionsWithClosedbiHexagonRight().

12416 {
12417  Short_t flag;
12418  Short_t nIntersections;
12419  Double_t FiStart,
12420  XintersectionList[16], // all the possible intersections
12421  YintersectionList[16]; // (up to 16 intersections).
12422 
12423 // The following is the form of the Left (looking from downstream into the beam) biHexagon
12424 // geometrical shape considered in this method :
12425 //
12426 /*
12427  |\
12428  | \
12429  | \
12430  \ \
12431  \ \
12432  | |
12433  | |
12434  / /
12435  / /
12436  / /
12437  | /
12438  | /
12439  |/
12440 */
12441 
12442 // finding all possible intersections with inner parallel straw region.
12443 // The inner parallel straw region is delimited by two hexagons.
12444 
12445  // flag meaning :
12446  // -1 --> track outside outer perimeter;
12447  // 0 --> at least 1 intersection with polygon, therefore a possible entry and an exit;
12448  // 1 --> track contained completely between the two polygons;
12449 
12450 
12452  vgap,
12453  Oxx,
12454  Oyy,
12455  Rr,
12456  ApotemaMin, // Apotema of the inner Hexagon,
12457  ApotemaMax,// Apotema of the outer Hexagon.
12458  &nIntersections,
12459  XintersectionList, // XintersectionList[..][0] --> inner polygon,
12460  // XintersectionList[..][1] --> outer polygon.
12461  YintersectionList
12462  );
12463 
12464  // IMPORTANT :
12465  // this is true because here it is assumed that the track comes from (0,0,0)
12466  // otherwise the code must be changed!
12467 
12468  if (!(flag == 0)) return flag;
12469  if( nIntersections<2) return -1;
12470 
12471 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
12472 // and the exit point (Xcross[1], Ycross[1]) of this track.
12473 
12474 //-------- the starting point of the track.
12475  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
12476 
12477  // this method selects the entrance and exit points of the trajectory among all
12478  // geometrical intersections of the circular trajectory with the straw particular
12479  // volume.
12480 
12481  // so at this point, the intersections are at least 2.
12482 
12484  Oxx,
12485  Oyy,
12486  Charge,
12487  FiStart,
12488  nIntersections,
12489  XintersectionList,
12490  YintersectionList,
12491  Xcross, // output
12492  Ycross // output
12493  );
12494 
12495 
12496 //----------------------
12497 
12498  return flag;
12499 
12500 }
Short_t IntersectionsWithClosedbiHexagonRight(Double_t vgap, Double_t Ox, Double_t Oy, Double_t R, Double_t Ami, Double_t Ama, Short_t *nIntersections, Double_t *XintersectionList, Double_t *YintersectionList)
timer Start()
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])
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Short_t PndSttTrackFinderReal::FindTrackEntranceExitHexagonCircle ( 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] 
)
private

Definition at line 12517 of file PndSttTrackFinderReal.cxx.

References atan2(), ChooseEntranceExit(), Double_t, and IntersectionsWithClosedPolygon().

12528 {
12529  Short_t flag;
12530  Short_t nIntersections[2];
12531  Double_t FiStart,
12532  XintersectionList[12][2], // second index =0 --> inner Hexagon, =1 --> outer.
12533  YintersectionList[12][2]; // first index : all the possible intersections
12534  // (up to 12 intersections).
12535 
12536 // finding all possible intersections with inner parallel straw region.
12537 // The inner parallel straw region is delimited by two hexagons.
12538 
12539  // flag meaning :
12540  // -2 --> track outside outer polygon;
12541  // -1 --> track contained completely within inner polygon;
12542  // 0 --> at least 1 intersection with inner polygon, at least 1 with outer polygon;
12543  // 1 --> track contained completely between the two polygons;
12544  // 2 --> track contained completely by larger polygons, with intersections in the smaller;
12545  // 3 --> track completely outsiede the small polygon with intersections in the bigger.
12546 
12547 
12549  Oxx,
12550  Oyy,
12551  Rr,
12552  ApotemaMin, // Rmin of the inner part of parallele straws,
12553  ApotemaMax,// max Apotema of the inner part of parallele straws.
12554  nIntersections,
12555  XintersectionList, // XintersectionList[..][0] --> inner polygon,
12556  // XintersectionList[..][1] --> outer polygon.
12557  YintersectionList
12558  );
12559 
12560  // IMPORTANT :
12561  // this is true because here it is assumed that the track comes from (0,0,0)
12562  // otherwise the code must be changed!
12563 
12564  if (!(flag == 0 || flag == 2)) return flag;
12565  if (flag == 2 &&nIntersections[0]<2 ){
12566  cout<<"PndSttTrackFinderReal::FindTrackEntranceExitbiHexagon,"<<
12567  " contraddiction, nIntersections[0]="<<
12568  nIntersections[0]<<"<2, returning -99!\n";
12569  return -99;
12570  }
12571 
12572 //------- among all possible intersection find the entrance point (Xcross[0], Ycross[0])
12573 // and the exit point (Xcross[1], Ycross[1]) of this track.
12574 
12575 //-------- the starting point of the track.
12576  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
12577 
12578  // this method selects the entrance and exit points of the trajectory among all
12579  // geometrical intersections of the circular trajectory with the straw particular
12580  // volume.
12581 
12583  Oxx,
12584  Oyy,
12585  flag,
12586  Charge,
12587  FiStart,
12588  nIntersections,
12589  XintersectionList,
12590  YintersectionList,
12591  Xcross, // output
12592  Ycross // output
12593  );
12594 
12595 //----------------------
12596 
12597  return flag;
12598 
12599 }
timer Start()
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
void ChooseEntranceExit(Double_t Oxx, Double_t Oyy, Short_t flag, Short_t Charge, Double_t FiStart, Short_t nIntersections[2], Double_t XintersectionList[][2], Double_t YintersectionList[][2], Double_t Xcross[2], Double_t Ycross[2])
Short_t IntersectionsWithClosedPolygon(Double_t Ox, Double_t Oy, Double_t R, Double_t Rmi, Double_t Rma, Short_t nIntersections[2], Double_t XintersectionList[][2], Double_t YintersectionList[][2])
Short_t PndSttTrackFinderReal::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] 
)
private

Definition at line 12615 of file PndSttTrackFinderReal.cxx.

References a, atan2(), b, c, ChooseEntranceExitbis(), Double_t, IntersectionsWithGapSemicircle(), IntersectionsWithOpenPolygon(), and sqrt().

12627 {
12628 
12629 // This methods finds the intersections between a trajectory coming from (0,0) and
12630 // parameters Oxx, Oyy, Rr with the closed geometrical figure (in XY) formed by the STT
12631 // external Left semicircle and the Outer STT parallel Left straw semi-Hexagon + Gap for
12632 // the pellet target target.
12633 // It returns -1 if there are 0 or 1 intersections, 0 if there are at least 2 intersections.
12634 
12635 
12636  Double_t cosFi,
12637  theta1,
12638  theta2,
12639  Theta1,
12640  Theta2,
12641  aaa,
12642  Fi,
12643  FI0,
12644  x1,
12645  x2,
12646  y1,
12647  y2;
12648 //------------------
12649 
12650  Short_t nIntersectionsCircle,
12651  nIntersections;
12652  Double_t FiStart,
12653  XintersectionList[12],
12654  YintersectionList[12]; // all the possible intersections (up to 12 intersections).
12655 
12656 // finding all possible intersections with inner parallel straw region.
12657 
12658 
12659  Double_t Side_x[] = { -GAP/2., -GAP/2. , -ApotemaMin, -ApotemaMin, -GAP/2., -GAP/2. },
12660  Side_y[] = { sqrt(Rma*Rma-GAP*GAP/4.), (2.*ApotemaMin-GAP)/sqrt(3.),
12661  ApotemaMin/sqrt(3.),
12662  -ApotemaMin/sqrt(3.),
12663  -(2.*ApotemaMin-GAP)/sqrt(3.), -sqrt(Rma*Rma-GAP*GAP/4.)},
12664  a[] = {1., -1./sqrt(3.), 1., 1./sqrt(3.), 1.},
12665  b[] = {0., 1., 0., 1., 0.},
12666  c[] = {GAP/2., -2.*ApotemaMin/sqrt(3.),ApotemaMin, 2.*ApotemaMin/sqrt(3.), GAP/2.};
12667 
12668  nIntersections=IntersectionsWithOpenPolygon(
12669  Oxx,
12670  Oyy,
12671  Rr,
12672  5, // n. Sides of open Polygon.
12673  a, // coefficient of formula : aX + bY + c = 0 defining the Polygon sides.
12674  b,
12675  c,
12676  Side_x, // X,Y coordinate of the Sides vertices (in sequence, following
12677  Side_y, // the Polygon along.
12678  XintersectionList, // XintersectionList
12679  YintersectionList // YintersectionList.
12680  );
12681 
12682 
12683 
12684 
12685 //-------------------------------------------------------------------------
12686 // finding intersections of trajectory [assumed to originate from (0,0) ]
12687 // with outer semicircle, the Left part.
12688 
12689  nIntersectionsCircle=IntersectionsWithGapSemicircle(
12690  Oxx, // input from trajectory
12691  Oyy, // input from trajectory
12692  Rr, // input from trajectory
12693  GAP, // input, vertical gap in XY plane of STT detector.
12694  true, // true --> Left semicircle, false --> Right semicircle.
12695  Rma, // radius of external Stt containment.
12696  &XintersectionList[nIntersections], // output, X list of intersections (maximal 2).
12697  &YintersectionList[nIntersections]
12698  );
12699  nIntersections += nIntersectionsCircle;
12700 
12701 //-------- the starting point of the track.
12702 
12703  if(nIntersections<2) return -1;
12704 
12705  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
12706 
12707  // this method selects the entrance and exit points of the trajectory among all
12708  // geometrical intersections of the circular trajectory with the straw particular
12709  // volume.
12710 
12711 
12713  Oxx,
12714  Oyy,
12715  Charge,
12716  FiStart,
12717  nIntersections,
12718  XintersectionList,
12719  YintersectionList,
12720  Xcross, // output
12721  Ycross // output
12722  );
12723 
12724 
12725  return 0;
12726 
12727 }
TTree * b
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
timer Start()
Int_t a
Definition: anaLmdDigi.C:126
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])
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Short_t IntersectionsWithOpenPolygon(Double_t Ox, Double_t Oy, Double_t R, 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)
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 PndSttTrackFinderReal::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] 
)
private

Definition at line 12745 of file PndSttTrackFinderReal.cxx.

References a, atan2(), b, c, ChooseEntranceExitbis(), Double_t, IntersectionsWithGapSemicircle(), IntersectionsWithOpenPolygon(), and sqrt().

12757 {
12758 
12759 // This methods finds the intersections between a trajectory coming from (0,0) and
12760 // parameters Oxx, Oyy, Rr with the closed geometrical figure (in XY) formed by the STT
12761 // external Left semicircle and the Outer STT parallel Left straw semi-Hexagon + Gap for
12762 // the pellet target target.
12763 // It returns -1 if there are 0 or 1 intersections, 0 if there are at least 2 intersections.
12764 
12765 
12766  Double_t cosFi,
12767  theta1,
12768  theta2,
12769  Theta1,
12770  Theta2,
12771  aaa,
12772  Fi,
12773  FI0,
12774  x1,
12775  x2,
12776  y1,
12777  y2;
12778 //------------------
12779 
12780  Short_t nIntersectionsCircle,
12781  nIntersections;
12782  Double_t FiStart,
12783  XintersectionList[12],
12784  YintersectionList[12]; // all the possible intersections (up to 10 intersections).
12785 
12786 // finding all possible intersections with inner parallel straw region.
12787 
12788 
12789  Double_t Side_x[] = { GAP/2., GAP/2. , ApotemaMin, ApotemaMin, GAP/2., GAP/2. },
12790  Side_y[] = { sqrt(Rma*Rma-GAP*GAP/4.), (2.*ApotemaMin-GAP)/sqrt(3.),
12791  ApotemaMin/sqrt(3.),
12792  -ApotemaMin/sqrt(3.),
12793  -(2.*ApotemaMin-GAP)/sqrt(3.), -sqrt(Rma*Rma-GAP*GAP/4.)},
12794  a[] = {1., 1./sqrt(3.), 1., -1./sqrt(3.), 1.},
12795  b[] = {0., 1., 0., 1., 0.},
12796  c[] = {-GAP/2.,-2.*ApotemaMin/sqrt(3.),-ApotemaMin, 2.*ApotemaMin/sqrt(3.), -GAP/2.};
12797 
12798  nIntersections=IntersectionsWithOpenPolygon(
12799  Oxx,
12800  Oyy,
12801  Rr,
12802  5, // n. Sides of open Polygon.
12803  a, // coefficient of formula : aX + bY + c = 0 defining the Polygon sides.
12804  b,
12805  c,
12806  Side_x, // X,Y coordinate of the Sides vertices (in sequence, following
12807  Side_y, // the Polygon along.
12808  XintersectionList, // XintersectionList
12809  YintersectionList // YintersectionList.
12810  );
12811 
12812 
12813 
12814 //-------------------------------------------------------------------------
12815 // finding intersections of trajectory [assumed to originate from (0,0) ]
12816 // with outer semicircle, the Left part.
12817 
12818  nIntersectionsCircle=IntersectionsWithGapSemicircle(
12819  Oxx, // input from trajectory
12820  Oyy, // input from trajectory
12821  Rr, // input from trajectory
12822  GAP, // input, vertical gap in XY plane of STT detector.
12823  false, // true --> Left semicircle, false --> Right semicircle.
12824  Rma, // radius of external Stt containment.
12825  &XintersectionList[nIntersections], // output, X list of intersections (maximal 2).
12826  &YintersectionList[nIntersections]
12827  );
12828 
12829 
12830  nIntersections += nIntersectionsCircle;
12831 
12832 //-------- the starting point of the track.
12833 
12834  if(nIntersections<2) return -1;
12835 
12836  FiStart = atan2( Start[1]-Oyy,Start[0]-Oxx);
12837 
12838  // this method selects the entrance and exit points of the trajectory among all
12839  // geometrical intersections of the circular trajectory with the straw particular
12840  // volume.
12841 
12843  Oxx,
12844  Oyy,
12845  Charge,
12846  FiStart,
12847  nIntersections,
12848  XintersectionList,
12849  YintersectionList,
12850  Xcross, // output
12851  Ycross // output
12852  );
12853 
12854 
12855  return 0;
12856 
12857 }
TTree * b
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
timer Start()
Int_t a
Definition: anaLmdDigi.C:126
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])
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Short_t IntersectionsWithOpenPolygon(Double_t Ox, Double_t Oy, Double_t R, 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)
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)
bool PndSttTrackFinderReal::FindTrackInXYProjection ( Short_t  iHit,
Short_t  nRcell,
Short_t  nFicell,
Int_t *  Minclinations,
Double_t  info[nmaxHits][7],
bool *  ExclusionList,
Short_t *  RConformalIndex,
Short_t *  FiConformalIndex,
Short_t  nBoxConformal[nRdivConformal][nFidivConformal],
Short_t  HitsinBoxConformal[MAXHITSINCELL][nRdivConformal][nFidivConformal],
Short_t  nTracksFoundSoFar,
Short_t *  nHitsinTrack,
Short_t  ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
Double_t trajectory_vertex,
Double_t  infoparalConformal[nmaxHits][5],
Double_t  posizSciTilx,
Double_t  posizSciTily,
Double_t S,
Double_t Ox,
Double_t Oy,
Double_t R,
Double_t Fi_low_limit,
Double_t Fi_up_limit,
Double_t Fi_initial_helix_referenceframe,
Double_t Fi_final_helix_referenceframe,
Short_t *  Charge,
Double_t U,
Double_t V 
)
private

this is supposed to be the charge, irrelevant here if it is +1 or -1.

Definition at line 13118 of file PndSttTrackFinderReal.cxx.

References ALFA, ApotemaMaxSkewStraw, AssociateSciTilHit(), atan2(), BETA, cos(), DIMENSIONSCITIL, Double_t, FindCharge(), FitHelixCylinder(), GAMMA, i, InclusionListSciTil, infoparal, istampa, IVOLTE, ListSciTilHitsinTrack, m, MINIMUMHITSPERTRACK, MINIMUMOUTERHITSPERTRACK, NHITSINFIT, CAMath::Nint(), nmaxHits, NN, nSciTilHitsinTrack, offset(), PI, PndSttFindingParallelTrackAngularRange(), PndSttFindTrackPatterninBoxConformal(), PndSttFindTrackPatterninBoxConformalSpecial(), PndSttFindTrackStrictCollection(), PndSttOrderingParallel(), PndSttTrkAssociatedParallelHitsToHelix5(), PndSttTrkAssociatedParallelHitsToHelixQuater(), RStrawDetectorMax, RStrawDetectorMin, S_SciTilHitsinTrack, sin(), sqrt(), status, TypeConf, X, Y, and YesSciTil.

Referenced by DoFind().

13148 {
13149 
13150 
13151 //---------------
13152 
13153  Short_t i,
13154  j,
13155  Naux,
13156  Nbaux,
13157  NN,
13158  Nouter,
13159  auxListHitsinTrack[nmaxHits],
13160  OutputListHitsinTrack[nmaxHits],
13161  OutputList2HitsinTrack[nmaxHits],
13162  ListHitsinTrackinWhichToSearch[nmaxHits];
13163 
13164  Short_t flagStt,
13165  status;
13166 
13167 
13168  Double_t aaa,
13169  m,
13170  q,
13171  rotationangle,
13172  rotationcos,
13173  rotationsin,
13174  auxinfoparalConformal[nmaxHits+1][5];
13175 
13176 
13177 //----------------
13178  nHitsinTrack[nTracksFoundSoFar] = PndSttFindTrackPatterninBoxConformal(
13179  1, // distance in R cells allowed
13180  2, // distance in Fi cells allowed
13181  Minclinations[0],
13182  iHit, // seed hit; if it is negative it is a SciTil hit.
13183  nRcell,
13184  nFicell,
13185  info,
13186  InclusionList,
13187  RConformalIndex,
13188  FiConformalIndex,
13189  nBoxConformal,
13190  HitsinBoxConformal,
13191  &ListHitsinTrack[nTracksFoundSoFar][0]
13192  );
13193 //---------stampe.
13194 if(istampa>0){
13195 cout<<"PndSttTrackFinderReal, evt. "<<IVOLTE<<
13196 ", dopo PndSttFindTrackPatterninBoxConformal; nTracksFoundSoFar "
13197  <<nTracksFoundSoFar<<", nHitsinTrack "<<
13198  nHitsinTrack[nTracksFoundSoFar]<<", ;loro lista :\n";
13199 for(int iz=0;iz<nHitsinTrack[nTracksFoundSoFar];iz++){
13200  cout<<"\thit n. (parallel numbering) "
13201  <<ListHitsinTrack[nTracksFoundSoFar][iz]
13202  <<endl;
13203 }
13204 }
13205 //------------------------------fine stampe.
13206 
13207  if( nHitsinTrack[nTracksFoundSoFar] < MINIMUMHITSPERTRACK ||
13208  nHitsinTrack[nTracksFoundSoFar]>nmaxHitsInTrack) {
13209  return false;
13210  }
13211 //-----------------------
13212 
13213 // find among the ListHitsinTrack if there are at least
13214 // a minimum # of hits belonging to the outer part of the STT system.
13215 // At this point of the code the Stt hits are already ordered from
13216 // the outermost to the innermost.
13217 
13218  for(j=0, Nouter =0; j<nHitsinTrack[nTracksFoundSoFar]; j++){
13219  if(info[infoparal[ ListHitsinTrack[nTracksFoundSoFar][j] ]][0]*
13220  info[infoparal[ ListHitsinTrack[nTracksFoundSoFar][j] ]][0]+
13221  info[infoparal[ ListHitsinTrack[nTracksFoundSoFar][j] ]][1]*
13222  info[infoparal[ ListHitsinTrack[nTracksFoundSoFar][j] ]][1]
13224  Nouter++;
13225  }
13226 
13227  if( Nouter >= MINIMUMOUTERHITSPERTRACK) {
13228  for(i=0; i< Nouter;i++){
13229  ListHitsinTrackinWhichToSearch[i]=
13230  ListHitsinTrack[nTracksFoundSoFar][i];
13231  }
13232 
13233  for(i=0; i< Nouter;i++){
13235  3, // NRCELLDISTANCE
13236  1, // NFiCELLDISTANCE
13237  Minclinations[0],
13238  Nouter,
13239  ListHitsinTrackinWhichToSearch[i], // seed hit.
13240  ListHitsinTrackinWhichToSearch,
13241  info,
13242  InclusionList,
13243  RConformalIndex,
13244  FiConformalIndex,
13245  nBoxConformal,
13246  HitsinBoxConformal,
13247  OutputListHitsinTrack);
13248  if( Naux >= MINIMUMOUTERHITSPERTRACK && Naux > 0.7 * Nouter ) break;
13249  if( Naux >= MINIMUMOUTERHITSPERTRACK) {
13250 
13251 // further collection of hits in the inner region but this time strictly connected
13252 // to the outer ones
13253 
13254 // first the list of non outer hits
13255  for(j=Nouter;j<nHitsinTrack[nTracksFoundSoFar]; j++){
13256  ListHitsinTrackinWhichToSearch[j-Nouter] =
13257  ListHitsinTrack[nTracksFoundSoFar][j];
13258  }
13259 
13261  1, // NFiCELLDISTANCE
13262  ListHitsinTrackinWhichToSearch[i], // seed hit
13263  nHitsinTrack[nTracksFoundSoFar]-Nouter,
13264  ListHitsinTrackinWhichToSearch,
13265  InclusionList,
13266  FiConformalIndex,
13267  OutputList2HitsinTrack
13268  );
13269 // add the new hits found to the list
13270 
13271  nHitsinTrack[nTracksFoundSoFar]=Naux+Nbaux;
13272  if( nHitsinTrack[nTracksFoundSoFar] >= MINIMUMHITSPERTRACK &&
13273  nHitsinTrack[nTracksFoundSoFar]<=nmaxHitsInTrack) {
13274  for(j=0;j<Naux;j++){
13275  ListHitsinTrack[nTracksFoundSoFar][j] =
13276  OutputListHitsinTrack[j];
13277  }
13278  for(j=0;j<Nbaux;j++){
13279  ListHitsinTrack[nTracksFoundSoFar][Naux+j] =
13280  OutputList2HitsinTrack[j];
13281  }
13282  break;
13283 
13284  }// end of if( nHitsinTrack[nTracksFoundSoFar] >= ....
13285  } // end of if( Naux >= MINIMUMOUTERHITSPERTRACK)
13286  } // end of for(i=0; i< Nouter;i++)
13287  } // end of if( Nouter >= MINIMUMOUTERHITSPERTRACK)
13288 
13289 
13290 
13291  if( nHitsinTrack[nTracksFoundSoFar] < MINIMUMHITSPERTRACK ||
13292  nHitsinTrack[nTracksFoundSoFar]>nmaxHitsInTrack) {
13293  return false;
13294  }
13295 
13296 //---------------------------
13297 
13298 // finding the rotation angle for best utilization of the MILP procedure
13299 
13300  for(j=0, rotationcos=0., rotationsin=0.; j<nHitsinTrack[nTracksFoundSoFar]; j++){
13301  rotationcos += cos((0.5+
13302  FiConformalIndex[infoparal[ListHitsinTrack[nTracksFoundSoFar][j]]])
13303  *2.*PI/nFidivConformal) ;
13304 
13305  rotationsin += sin((0.5+
13306  FiConformalIndex[infoparal[ListHitsinTrack[nTracksFoundSoFar][j]]])
13307  *2.*PI/nFidivConformal) ;
13308  }
13309  rotationcos /=nHitsinTrack[nTracksFoundSoFar];
13310  rotationsin /=nHitsinTrack[nTracksFoundSoFar];
13311  rotationangle = atan2(rotationsin, rotationcos);
13312 
13313 // fitting with superfast MILP code
13314 
13315 // loading the conformal infos necessary in the fit :
13316 // auxinfoparalConformal[j][0] = U;
13317 // auxinfoparalConformal[j][1] = V;
13318 // auxinfoparalConformal[j][2] = drift radius in conformal space; for the SciTil
13319 // the SciTil dimension (2.85 cm)/Rmiddle**2 with
13320 // Rmiddle = distance middle of SciTil from (0,0), so
13321 // = DIMENSIONSCITIL/RMAXSCITIL**2.
13322 
13323 
13324  bool Type;
13325  int nFitPoints,
13326  offset;
13327  Double_t
13328  Xconformal[1+nHitsinTrack[nTracksFoundSoFar]],
13329  Yconformal[1+nHitsinTrack[nTracksFoundSoFar]],
13330  DriftRadiusconformal[1+nHitsinTrack[nTracksFoundSoFar]],
13331  ErrorDriftRadiusconformal[1+nHitsinTrack[nTracksFoundSoFar]];
13332 
13333  if(iHit<0){ // case with a hit in the SciTil
13334  aaa = posizSciTilx*posizSciTilx+posizSciTily*posizSciTily;
13335  Xconformal[0] =posizSciTilx/aaa;
13336  Yconformal[0] =posizSciTily/aaa;
13337  ErrorDriftRadiusconformal[0] = DIMENSIONSCITIL/aaa;
13338  DriftRadiusconformal[0]=-1.; // treat it like it is a Mvd hit.
13339 
13340  // +1 comes from one SciTil hit.
13341  offset=1;
13342  nFitPoints = nHitsinTrack[nTracksFoundSoFar]+1;
13343 
13344  } else { // no SciTil hit.
13345  offset=0;
13346  nFitPoints = nHitsinTrack[nTracksFoundSoFar];
13347  } // end of if(iHit<0)
13348 
13349  for(j=0; j<nHitsinTrack[nTracksFoundSoFar]; j++){
13350  Xconformal[j+offset] =infoparalConformal[ListHitsinTrack[nTracksFoundSoFar][j]][0];
13351  Yconformal[j+offset] =infoparalConformal[ListHitsinTrack[nTracksFoundSoFar][j]][1];
13352  ErrorDriftRadiusconformal[j+offset]=
13353  infoparalConformal[ListHitsinTrack[nTracksFoundSoFar][j]][2];
13354  DriftRadiusconformal[j+offset]=
13355  infoparalConformal[ListHitsinTrack[nTracksFoundSoFar][j]][2];
13356  }
13357 
13358 
13359 
13360 
13361 //------------------------
13362 if(istampa>0){
13363 
13364 cout<<"PndSttTrackFinderReal, in FindTrackInXYProjection, evt. "
13365 <<IVOLTE<<", nTracksFoundSoFar "<<
13366 nTracksFoundSoFar <<" nHits "<<nHitsinTrack[nTracksFoundSoFar]
13367 <<", iseed "<<iHit<<endl;
13368 cout<<"\tLista Stt Hits :\n";
13369 for(int iz=0;iz<nHitsinTrack[nTracksFoundSoFar];iz++){
13370  cout<<"\tStt hit n. "<<ListHitsinTrack[nTracksFoundSoFar][iz]<<endl;
13371 }
13372 cout<<"\tLista info in Conformal :\n";
13373 int nummm;
13374  if(iHit<0) { nummm=nHitsinTrack[nTracksFoundSoFar]+1;}
13375  else{nummm=nHitsinTrack[nTracksFoundSoFar];};
13376 for(int iz=0;iz<nummm;iz++){
13377  cout<<"\t"<<Xconformal[iz]<<", "<<
13378  Yconformal[iz]<<", "<<
13379  ErrorDriftRadiusconformal[iz]<<endl;
13380 }
13381 
13382 }
13383 //--------------------
13384 
13385 
13386  status = FitHelixCylinder(
13387  nFitPoints, // +1 comes from one SciTil hit.
13388  Xconformal,
13389  Yconformal,
13390  DriftRadiusconformal,
13391  ErrorDriftRadiusconformal,
13392  rotationangle, // rotationangle, da mettere
13393  trajectory_vertex, // vertex in (X,Y) of this trajectory
13394  NHITSINFIT, // maximum n. of hits allowed in fast fit
13395  &m,
13396  &q,
13397  &ALFA[nTracksFoundSoFar],
13398  &BETA[nTracksFoundSoFar],
13399  &GAMMA[nTracksFoundSoFar],
13400  &TypeConf[nTracksFoundSoFar]
13401  );
13402 
13403  if(status < 0 ) return false;
13404 
13405 // this trasformation is valid even if the equation is a straight line from the fit
13406 
13407  Ox[nTracksFoundSoFar]= -0.5*ALFA[nTracksFoundSoFar];
13408  Oy[nTracksFoundSoFar]= -0.5*BETA[nTracksFoundSoFar];
13409  R[nTracksFoundSoFar]= Ox[nTracksFoundSoFar]*Ox[nTracksFoundSoFar]+
13410  Oy[nTracksFoundSoFar]*Oy[nTracksFoundSoFar]-
13411  GAMMA[nTracksFoundSoFar];
13412 
13413  // some obvious preliminary cuts
13414  if( R[nTracksFoundSoFar] < 0. ) return false;
13415  R[nTracksFoundSoFar]= sqrt( R[nTracksFoundSoFar] );
13416  aaa = sqrt(Ox[nTracksFoundSoFar]*Ox[nTracksFoundSoFar]+
13417  Oy[nTracksFoundSoFar]*Oy[nTracksFoundSoFar]);
13418 
13419  // the following is because the circumference is supposed to come from (0,0);
13420  // here the factor 0.9 is used in order to be conservative.
13421  if(aaa< 0.9*RStrawDetectorMin/2.) return false;
13422 
13423 // here the factor 0.9 is used in order to be conservative.
13424  if ( R[nTracksFoundSoFar] + aaa < RStrawDetectorMin *0.9 ) return false;
13425 
13426 //---------------------------
13427 
13428 // check again if the SciTil hit (if present) is compatible with this circle trajectory
13429 // in XY by finding if it has intersection (in the XY plane) with Helix circle
13430 
13431 // equation of the SciTil segment : y0 * y + x0 * x - x0**2 - y0**2 = 0
13432 // where (x0,y0) = position of center of the SciTil.
13433 
13434 // delimiting points of the SciTil segment : define L = length of the SciTil,
13435 // and RR = sqrt(x0**2+y0**2), SIGN = the sign of (-x0*y0) or SIGN=1 when y0=0,
13436 // SIGN=irrelevant when x0=0; then :
13437 // P1 = [ x0- abs{(L/2)*y0/RR}; y0-SIGN*abs{(L/2)*x0/RR} ],
13438 // P2 = [ x0+abs{(L/2)*y0/RR}; y0+SIGN*abs{(L/2)*x0/RR} ].
13439 
13440  bool intersect;
13441  Short_t
13442  Nint,
13443  nSciT;
13444  Double_t distance,
13445  QQ,
13446  sqrtRR,
13447  SIGN,
13448  XintersectionList[2],
13449  YintersectionList[2];
13450 
13451 
13452  // whether or not the seed hit was a Stt hit try if any SciTil hits are
13453  // associated to this track cand.
13454 
13455  if(YesSciTil){
13456  // nScit is the n. of SciTil hit associated to this track.
13457  nSciT = AssociateSciTilHit(
13458  Ox[nTracksFoundSoFar],
13459  Oy[nTracksFoundSoFar],
13460  R[nTracksFoundSoFar],
13461  &ListSciTilHitsinTrack[nTracksFoundSoFar][0],
13462  S// output; S on the lateral face of the Helix
13463  // of the SciTil hit (if present).
13464  );
13465  if(nSciT>0){
13466  nSciTilHitsinTrack[nTracksFoundSoFar]=nSciT;
13467  for(j=0;j<nSciTilHitsinTrack[nTracksFoundSoFar];j++){
13468  InclusionListSciTil[ListSciTilHitsinTrack[nTracksFoundSoFar][0]]
13469  =false;
13470  S_SciTilHitsinTrack[nTracksFoundSoFar][j]=S[j];
13471  }
13472  } else {
13473  nSciTilHitsinTrack[nTracksFoundSoFar]=0;
13474  }
13475  }else{
13476  nSciTilHitsinTrack[nTracksFoundSoFar]=0;
13477  } // end of if(YesSciTil)
13478 
13479 
13480 //--------------------- better association of the hits in the track candidate
13481 // treat differently the case in which the track has radius < RStrawDetectorMax/2
13482 // and the other case.
13483 
13484  if( R[nTracksFoundSoFar] < RStrawDetectorMax/2){
13486  Ox[nTracksFoundSoFar],
13487  Oy[nTracksFoundSoFar],
13488  R[nTracksFoundSoFar],
13489  1,
13490  &Fi_low_limit[nTracksFoundSoFar],
13491  &Fi_up_limit[nTracksFoundSoFar],
13492  &flagStt,
13495  );
13496 
13498  InclusionList,
13499  Minclinations[0],
13500  Ox[nTracksFoundSoFar],
13501  Oy[nTracksFoundSoFar],
13502  R[nTracksFoundSoFar],
13503  info,
13504  Fi_low_limit[nTracksFoundSoFar],
13505  Fi_up_limit[nTracksFoundSoFar],
13506  auxListHitsinTrack // this is the output
13507  );
13508 
13509 
13510  } else {
13511 
13513  InclusionList,
13514  m,
13515  q,
13516  status,
13517  nHitsinTrack[nTracksFoundSoFar],
13518  &ListHitsinTrack[nTracksFoundSoFar][0],
13519  Minclinations[0],
13520  Ox[nTracksFoundSoFar],
13521  Oy[nTracksFoundSoFar],
13522  R[nTracksFoundSoFar],
13523  info,
13524  infoparalConformal,
13525  RConformalIndex,
13526  FiConformalIndex,
13527  nBoxConformal,
13528  HitsinBoxConformal,
13529  auxListHitsinTrack // this is the output
13530  );
13531  } // end of if( R[nTracksFoundSoFar] < RStrawDetectorMax/2)
13532 
13533  if( NN < MINIMUMHITSPERTRACK || NN>nmaxHitsInTrack) return false;
13534 
13535  nHitsinTrack[nTracksFoundSoFar]=NN;
13536 
13537  for(i=0; i<nHitsinTrack[nTracksFoundSoFar];i++){
13538  ListHitsinTrack[nTracksFoundSoFar][i]=auxListHitsinTrack[i];
13539  }
13540 
13541 
13542 
13543 //----------------------------- Finding the Charge
13544  // The charge is calculated first by dividing the hits in two categories by using the Perpendicular
13545  // to the tangent to the trajectory in (0,0). Then simply the majority of the hits decides the
13546  // sign of the charge. See Gianluigi's Logbook page 290.
13547 
13548  Double_t
13549  X[nHitsinTrack[nTracksFoundSoFar]],
13550  Y[nHitsinTrack[nTracksFoundSoFar]];
13551 
13552  for(i=0;i<nHitsinTrack[nTracksFoundSoFar];i++){
13553  X[i]=info[infoparal[ListHitsinTrack[nTracksFoundSoFar][i]]][0];
13554  Y[i]=info[infoparal[ListHitsinTrack[nTracksFoundSoFar][i]]][1];
13555  }
13556  FindCharge(
13557  Ox[nTracksFoundSoFar],
13558  Oy[nTracksFoundSoFar],
13559  nHitsinTrack[nTracksFoundSoFar],
13560  X,
13561  Y,
13562  &Charge[nTracksFoundSoFar]
13563  );
13564 
13565 
13566 //----------------------------- Ordering.
13567  // The ordering reflects the angle Fi in the Helix reference frame because
13568  // the hits are ordered by going around the trajectory cclockwise for
13569  // positive tracks or counterclockwise for negative particles; in other words
13570  // it is not used simply the distance of the hit from (0,0) as ordering parameter
13571  // but the track length of the circle.
13572  // this method finds also Fi_initial_helix_referenceframe and Fi_final_helix_referenceframe.
13573  // The former is simply the fi angle of the point (0,0) with respect to the center
13574  // of this Helix. Important : this angle has to be > 0 always and it is between 0. and
13575  // 2 PI here (later, FixDiscontinuitiesFiangleinSZplane may change it adding +2PI or
13576  // -2PI if necessary).
13577  // Fi_final_helix_referenceframe is made such that it is < Fi_initial_helix_referenceframe
13578  // when the track is positive, and it is > Fi_initial_helix_referenceframe for negative
13579  // tracks.
13580 
13582  Ox[nTracksFoundSoFar],
13583  Oy[nTracksFoundSoFar],
13584  info,
13585  nHitsinTrack[nTracksFoundSoFar],
13586  &ListHitsinTrack[nTracksFoundSoFar][0],
13587  infoparal,
13588  Charge[nTracksFoundSoFar],
13589  &Fi_initial_helix_referenceframe[nTracksFoundSoFar],//output
13590  &Fi_final_helix_referenceframe[nTracksFoundSoFar],// output
13591  U,
13592  V
13593  );
13594 
13595 // finding the FI angular range (in the laboratory frame) spanned by this parallel track
13596 
13598  Ox[nTracksFoundSoFar],
13599  Oy[nTracksFoundSoFar],
13600  R[nTracksFoundSoFar],
13601  Charge[nTracksFoundSoFar],
13602  &Fi_low_limit[nTracksFoundSoFar],
13603  &Fi_up_limit[nTracksFoundSoFar],
13604  &flagStt,
13607  );
13608 
13609 
13610  if( flagStt == -2 ) return false; // track outside cylinder RStrawDetectorMax.
13611  if( flagStt == -1 ) return false; // track inside cylinder RStrawDetectorMin.
13612  if( flagStt == 1 ) return false; // track comprised in cylinder : discard,
13613  // because at this stage only tracks from
13614  // vertex are searched.
13615 
13616 
13617 
13618 
13619 //-------------------------------------------------- macro for display
13620 
13621  for(j=0; j<nHitsinTrack[nTracksFoundSoFar]; j++){
13622  for(i=0; i<5;i++){
13623  auxinfoparalConformal[j][i] =
13624  infoparalConformal[ ListHitsinTrack[nTracksFoundSoFar][j]][i];
13625  }
13626  }
13627 
13628 
13629 /*
13630 if(iplotta && IVOLTE <= nmassimo){
13631  WriteMacroParallelHitsConformalwithMCspecial(
13632  nHitsinTrack[nTracksFoundSoFar],
13633  auxinfoparalConformal,
13634  nTracksFoundSoFar,
13635  status,
13636  trajectory_vertex
13637  );
13638 }
13639 */
13640 
13641 //----------------------------------- end macro for display
13642 
13643  return true;
13644 };
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
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
void PndSttFindingParallelTrackAngularRange(Double_t oX, Double_t oY, Double_t r, Short_t Charge, Double_t *Fi_low_limit, Double_t *Fi_up_limit, Short_t *status, Double_t Rmin, Double_t Rmax)
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, Short_t NMAX, Double_t *m, Double_t *q, Double_t *ALFA, Double_t *BETA, Double_t *GAMMA, bool *TypeConf)
static const Short_t NHITSINFIT
static const Double_t RStrawDetectorMin
TVector3 offset(2, 0, 0)
void FindCharge(Double_t oX, Double_t oY, Short_t nParallelHits, Double_t *X, Double_t *Y, Short_t *Charge)
double Y
Definition: anaLmdDigi.C:68
Short_t PndSttFindTrackPatterninBoxConformal(Short_t NRCELLDISTANCE, Short_t NFiCELLDISTANCE, Short_t Nparal, Short_t ihit, Short_t nRcell, Short_t nFicell, Double_t info[][7], bool Exclusion_List[nmaxHits], Short_t RConformalIndex[nmaxHits], Short_t FiConformalIndex[nmaxHits], Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t *ListHitsinTrack)
Double_t GAMMA[MAXTRACKSPEREVENT]
Short_t AssociateSciTilHit(Double_t Oxx, Double_t Oyy, Double_t Rr, Short_t *List, Double_t *esse)
Double_t
Short_t PndSttTrkAssociatedParallelHitsToHelixQuater(bool ExclusionList[nmaxHits], Double_t m, Double_t q, Short_t Status, Short_t nHitsinTrack, Short_t *ListHitsinTrack, Int_t NhitsParallel, Double_t Ox, Double_t Oy, Double_t R, Double_t info[][7], Double_t infoparalConformal[][5], Short_t *RConformalIndex, Short_t *FiConformalIndex, Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t *auxListHitsinTrack)
Double_t BETA[MAXTRACKSPEREVENT]
static const Short_t nFidivConformal
Double_t S_SciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHits]
void PndSttOrderingParallel(Double_t oX, Double_t oY, Double_t info[][7], Short_t nParallelHits, Short_t *ListParallelHits, Short_t *Infoparal, Short_t Charge, Double_t *Fi_initial_helix_referenceframe, Double_t *Fi_final_helix_referenceframe, Double_t *U, Double_t *V)
static const Short_t nmaxHits
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
double X
Definition: anaLmdDigi.C:68
Short_t PndSttTrkAssociatedParallelHitsToHelix5(bool ExclusionList[nmaxHits], Int_t NhitsParallel, Double_t Ox, Double_t Oy, Double_t R, Double_t info[][7], Double_t Fi_low, Double_t Fi_up, Short_t *auxListHitsinTrack)
static const Double_t PI
static const Short_t nmaxHitsInTrack
Short_t nSciTilHitsinTrack[MAXTRACKSPEREVENT]
Short_t PndSttFindTrackPatterninBoxConformalSpecial(Short_t NRCELLDISTANCE, Short_t NFiCELLDISTANCE, Short_t Nparal, Short_t NparallelToSearch, Short_t iSeed, Short_t *ListHitsinTrackinWhichToSearch, Double_t info[][7], bool InclusionList[nmaxHits], Short_t RConformalIndex[nmaxHits], Short_t FiConformalIndex[nmaxHits], Short_t nBoxConformal[nRdivConformal][nFidivConformal], Short_t HitsinBoxConformal[][nRdivConformal][nFidivConformal], Short_t *OutputListHitsinTrack)
Short_t ListSciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHitsinTrack]
bool TypeConf[MAXTRACKSPEREVENT]
Double_t ALFA[MAXTRACKSPEREVENT]
bool InclusionListSciTil[nmaxSciTilHits]
Double_t R
Definition: checkhelixhit.C:61
static const Double_t RStrawDetectorMax
int Nint(float x)
Definition: PndCAMath.h:117
static const Double_t DIMENSIONSCITIL
static const Double_t ApotemaMaxSkewStraw
int status[10]
Definition: f_Init.h:28
Short_t PndSttFindTrackStrictCollection(Short_t NFiCELLDISTANCE, Short_t iSeed, Short_t NParallelToSearch, Short_t *ListHitsinTrackinWhichToSearch, bool ExclusionList[nmaxHits], Short_t FiConformalIndex[nmaxHits], Short_t *OutputListHitsinTrack)
void PndSttTrackFinderReal::Finish ( )
inlinevirtual

Virtual method Finish. If needed, to be implemented in the concrete class. Executed at the end of the run.

Implements PndSttTrackFinder.

Definition at line 83 of file PndSttTrackFinderReal.h.

83 {};
Short_t PndSttTrackFinderReal::FitHelixCylinder ( Short_t  nHitsinTrack,
Double_t Xconformal,
Double_t Yconformal,
Double_t DriftRadiusconformal,
Double_t ErrorDriftRadiusconformal,
Double_t  rotationangle,
Double_t trajectory_vertex,
Short_t  NMAX,
Double_t m,
Double_t q,
Double_t ALFA,
Double_t BETA,
Double_t GAMMA,
bool *  TypeConf 
)
private

Definition at line 7179 of file PndSttTrackFinderReal.cxx.

References angle, cos(), Double_t, fabs(), i, istampa, IVOLTE, PI, printf(), sin(), and status.

Referenced by FindTrackInXYProjection().

7195 {
7196 
7197 
7198  // definition of variables for the glpsol solver
7199  // ROWS (for read_rows function)
7200  //
7201  Short_t NpointsInFit = nHitsinTrack-NMAX <0 ? nHitsinTrack : NMAX;
7202 
7203  bool mvdhit[NpointsInFit];
7204 
7205 
7206  Double_t M = 1.,
7207  m_result,
7208  q_result,
7209  A,
7210  alfetta,
7211  angle,
7212  offsety,
7213  Delta[NpointsInFit],
7214  Ox[NpointsInFit],
7215  Oy[NpointsInFit];
7216 
7217  Short_t i, j, ii, iii, nSttHits, nMvdHits;
7218  Short_t Status;
7219 
7220  char nome[300], stringa[300], stringa2[300];
7221  float m1_result,m2_result, q1_result,q2_result, A1_result, A2_result;
7222 
7223 // --
7224 
7225 //-------------- stampaggi
7226 if(istampa>=3){
7227  cout<<"from FitHelixCylinder,prima di rotazione, Evento "<<IVOLTE<<", nHitsinTrack = "<<nHitsinTrack
7228  <<"\nfrom FitHelixCylinder, nPointsinFit = "<<NpointsInFit<<endl;
7229  for(i=0 ; i< NpointsInFit ; i++) {
7230  cout<<" Xconformal["<<i<<"] = "<<Xconformal[ i ]<<
7231  "; Yconformal["<<i<<"] = "<<Yconformal[ i ]<<", drift radius conformal "<<
7232  DriftRadiusconformal[i]<<endl<<"\tErrordiriftradiusconformal = "
7233  <<ErrorDriftRadiusconformal[i]<<endl;
7234  }
7235 }
7236 //------------ end stampaggi
7237 
7238 
7239 
7240  if( nHitsinTrack < 2) {
7241  return -1;
7242  }
7243 // use the trick of increasing the rotation angle by 10 degrees in order to obtain always a positive m
7244  rotationangle -= PI/18.;
7245 
7246  Double_t cose = cos(rotationangle), sine = sin(rotationangle);
7247 
7248 
7249 
7250  nSttHits = nMvdHits = 0;
7251  for(i=0;i<NpointsInFit; i++){
7252  Ox[i] = Xconformal[ i ] *cose + Yconformal[ i ]*sine;
7253  Oy[i] = -Xconformal[ i ] *sine + Yconformal[ i ]*cose;
7254  Delta[i] = 3.*ErrorDriftRadiusconformal[ i ]; // 3 times the Drift Radius
7255 
7256  if( DriftRadiusconformal[ i ]<0. )
7257  {
7258  mvdhit[i]=true;
7259  nMvdHits++;
7260  } else {
7261  mvdhit[i]=false;
7262  nSttHits++;
7263  }
7264  }
7265 
7266 //-------------- stampaggi
7267 if(istampa>=3){
7268  cout<<"from FitHelixCylinder, dopo rotazione, Evento "<<IVOLTE<<", nHitsinTrack = "<<nHitsinTrack
7269  <<"\nfrom FitHelixCylinder, nPointsinFit = "<<NpointsInFit<<endl;
7270  for(i=0 ; i< NpointsInFit ; i++) {
7271  cout<<" Ox["<<i<<"] = "<<Ox[ i ]<<
7272  "; Oy["<<i<<"] = "<<Oy[ i ]<<", Delta "<<
7273  Delta[i]<<endl;
7274  }
7275 }
7276 //------------ end stampaggi
7277 //--------- calculation of # structural variables (see Gianluigi's logbook pag. 236) etc.etc.
7278 
7279  int NStructVar = 4 + 1 + nMvdHits * 2 + nSttHits *4 ;
7280 // m1,m2,q1,q2 DUMMY lam & sigma lamp & lamm & sigmap & sigmam
7281 
7282 
7283  int nRows = 1 + nMvdHits * 4 + nSttHits * 9;
7284 // OBJECT A,B,C,D Ap,Bp,Cp,Dp,Am,Bm,Cm,Dm,LAMBDA
7285 
7286 //---- creating the various service arrays
7287  int typeRows[nRows];
7288  char * nameRows[nRows];
7289  char auxnameRows[nRows][20];
7290 
7291  int NStructRowsMax = 8*NpointsInFit ; // maximum number of ROWS in which a
7292  // structural variable (for instance M ) can be found
7293  double final_values[NStructVar];
7294  int NRowsInWhichStructVarArePresent[NStructVar];
7295  char *StructVarName[NStructVar];
7296  char auxStructVarName[NStructVar][20];
7297  char *NameRowsInWhichStructVarArePresent[NStructVar*NStructRowsMax];
7298  char aux[NStructVar*NStructRowsMax][20];
7299  double Coefficients[NStructVar*NStructRowsMax];
7300 
7301  //--------for RHS information
7302  double ValueB[nRows-1]; // -1 because OBJECT dowsn't have a RHS boundary.
7303  //--------for RANGES information
7304  int nRanges = nSttHits;
7305  double ValueRanges[nRanges];
7306  char *NameRanges[nRanges];
7307  char auxNameRanges[nRanges][20];
7308 
7309  //--------for BOUNDS information
7310  int nBounds=NpointsInFit+nSttHits+1;
7311  double BoundValue[nBounds];
7312  char *BoundStructVarName[nBounds];
7313  char auxBoundStructVarName[nBounds][20];
7314  char *TypeofBound[nBounds];
7315  char auxTypeofBound[nBounds][20];
7316  //--------end BOUNDS information
7317 
7318 //---------------------------------------------------
7319 
7320 
7321 
7322 
7323 //--- calculate array NRowsInWhichStructVarArePresent
7324  NRowsInWhichStructVarArePresent[0] = // this is for m1
7325  NRowsInWhichStructVarArePresent[1] = // this is for m2
7326  NRowsInWhichStructVarArePresent[2] = // this is for q1
7327  NRowsInWhichStructVarArePresent[3] = nMvdHits*2 + nSttHits *4; // this is for q2
7328  //--- the following is for the lam* (Mvd hits) or lamp* (Stt hits) structural variables
7329  for(i=0,ii=0; i< NpointsInFit ; i++) {
7330  if( mvdhit[i]){
7331  NRowsInWhichStructVarArePresent[4+ii]= 4;
7332  } else {
7333  NRowsInWhichStructVarArePresent[4+ii]= 5;
7334  }
7335  ii++;
7336  }
7337  //--- the following is for the lamm* (Mvd Hits, if any) structural variables
7338  for(i=0; i< NpointsInFit ; i++) {
7339  if( !mvdhit[i]){
7340  NRowsInWhichStructVarArePresent[4+ii]= 5;
7341  ii++;
7342  }
7343  }
7344 
7345  //--- the following is for the sigma structural variables
7346  for(i=0 ; i< nMvdHits+2*nSttHits ; i++) {
7347  NRowsInWhichStructVarArePresent[4+ii+i]= 5;
7348  }
7349 //--- the following is for the DUMMY structural variable
7350  NRowsInWhichStructVarArePresent[4+ii+nMvdHits+2*nSttHits]= nMvdHits*4 + nSttHits*8;
7351 
7352 
7353 
7354 
7355 //----------------- write the ROWS section
7356 
7357 
7358 
7359 
7360 
7361 
7362  sprintf(&(auxnameRows[0][0]),"OBJECT");
7363  nameRows[0]=&auxnameRows[0][0];
7364  typeRows[0]=GLP_FR;
7365  for(i=0 , ii=0 ; i< NpointsInFit ; i++) {
7366 
7367  if( mvdhit[i]){
7368  typeRows[1+ii]=GLP_UP;typeRows[2+ii]=GLP_UP;typeRows[3+ii]=GLP_UP;typeRows[4+ii]=GLP_UP;
7369  typeRows[5+ii]=GLP_LO;
7370 
7371  sprintf(&(auxnameRows[1+ii][0]),"A%d",i); nameRows[1+ii]=&auxnameRows[1+ii][0];
7372  sprintf(&(auxnameRows[2+ii][0]),"B%d",i); nameRows[2+ii]=&auxnameRows[2+ii][0];
7373  sprintf(&(auxnameRows[3+ii][0]),"C%d",i); nameRows[3+ii]=&auxnameRows[3+ii][0];
7374  sprintf(&(auxnameRows[4+ii][0]),"D%d",i); nameRows[4+ii]=&auxnameRows[4+ii][0];
7375  ii+=4;
7376 
7377  } else {
7378  typeRows[1+ii]=GLP_UP;typeRows[2+ii]=GLP_UP;typeRows[3+ii]=GLP_UP;typeRows[4+ii]=GLP_UP;
7379  typeRows[5+ii]=GLP_UP;typeRows[6+ii]=GLP_UP;typeRows[7+ii]=GLP_UP;typeRows[8+ii]=GLP_UP;
7380  typeRows[9+ii]=GLP_LO;
7381 
7382  sprintf(&(auxnameRows[1+ii][0]),"Ap%d",i); nameRows[1+ii]=&auxnameRows[1+ii][0];
7383  sprintf(&(auxnameRows[2+ii][0]),"Bp%d",i); nameRows[2+ii]=&auxnameRows[2+ii][0];
7384  sprintf(&(auxnameRows[3+ii][0]),"Cp%d",i); nameRows[3+ii]=&auxnameRows[3+ii][0];
7385  sprintf(&(auxnameRows[4+ii][0]),"Dp%d",i); nameRows[4+ii]=&auxnameRows[4+ii][0];
7386  sprintf(&(auxnameRows[5+ii][0]),"Am%d",i); nameRows[5+ii]=&auxnameRows[5+ii][0];
7387  sprintf(&(auxnameRows[6+ii][0]),"Bm%d",i); nameRows[6+ii]=&auxnameRows[6+ii][0];
7388  sprintf(&(auxnameRows[7+ii][0]),"Cm%d",i); nameRows[7+ii]=&auxnameRows[7+ii][0];
7389  sprintf(&(auxnameRows[8+ii][0]),"Dm%d",i); nameRows[8+ii]=&auxnameRows[8+ii][0];
7390  sprintf(&(auxnameRows[9+ii][0]),"LAMBDA%d",i); nameRows[9+ii]=&auxnameRows[9+ii][0];
7391  ii+=9;
7392  }
7393  }
7394 
7395 
7396 
7397 
7398 //----------------- write the COLUMNS section
7399 
7400 // fprintf(FMCS,"COLUMNS\n"); //--------stampaggi
7401 
7402 // Column variable m1
7403 
7404  ii=0;
7405  for(i=0 ; i< NpointsInFit ; i++) {
7406 
7407  if( mvdhit[i]){
7408 //---stampaggi
7409 // fprintf(FMCS," m1 A%d %g\n m1 B%d %g\n",i,Ox[i],i,-Ox[i]);
7410 //-----stampaggi, fine
7411 
7412  Coefficients[ii]= Ox[i];
7413  Coefficients[ii+1]= -Ox[i];
7414  ii +=2;
7415  } else {
7416 //---stampaggi
7417 // fprintf(FMCS," m1 Ap%d %g Am%d %g\n m1 Bp%d %g Bm%d %g\n",
7418 // i,Ox[i],i,Ox[i],i,-Ox[i],i,-Ox[i]);
7419 //-----stampaggi, fine
7420 
7421  Coefficients[ii]= Ox[i];
7422  Coefficients[ii+1]= Ox[i];
7423  Coefficients[ii+2]= -Ox[i];
7424  Coefficients[ii+3]= -Ox[i];
7425  ii += 4;
7426  }
7427  }
7428 
7429 
7430 
7431 // Column variable m2
7432  for(i=0, ii=0; i< NpointsInFit ; i++) {
7433  if( mvdhit[i]){
7434 // fprintf(FMCS," m2 A%d %g\n m2 B%d %g\n",//---stampaggi
7435 // i,-Ox[i],i,Ox[i]);//---stampaggi
7436  Coefficients[NStructRowsMax+ii]= -Ox[i];
7437  Coefficients[NStructRowsMax+ii+1]= Ox[i];
7438  ii += 2;
7439  } else {
7440 // fprintf(FMCS," m2 Ap%d %g Am%d %g\n m2 Bp%d %g Bm%d %g\n",//---stampaggi
7441 // i,-Ox[i],i,-Ox[i],i,Ox[i],i,Ox[i]);//---stampaggi
7442  Coefficients[NStructRowsMax+ii]= -Ox[i];
7443  Coefficients[NStructRowsMax+ii+1]= -Ox[i];
7444  Coefficients[NStructRowsMax+ii+2]= Ox[i];
7445  Coefficients[NStructRowsMax+ii+3]= Ox[i];
7446  ii += 4;
7447  }
7448  }
7449 
7450 // Column variable q1
7451  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
7452  if( mvdhit[i]){
7453 // fprintf(FMCS," q1 A%d 1.\n q1 B%d -1.\n",//---stampaggi
7454 // i,i);//---stampaggi
7455  Coefficients[2*NStructRowsMax+ii]= 1.;
7456  Coefficients[2*NStructRowsMax+ii+1]= -1.;
7457  ii +=2;
7458  } else {
7459 // fprintf(FMCS," q1 Ap%d 1. Am%d 1.\n q1 Bp%d -1. Bm%d -1.\n",//---stampaggi
7460 // i,i,i,i);//---stampaggi
7461  Coefficients[2*NStructRowsMax+ii]= 1.;
7462  Coefficients[2*NStructRowsMax+ii+1]= 1.;
7463  Coefficients[2*NStructRowsMax+ii+2]= -1.;
7464  Coefficients[2*NStructRowsMax+ii+3]= -1.;
7465  ii += 4;
7466  }
7467  }
7468 
7469 // Column variable q2
7470  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
7471  if( mvdhit[i]){
7472 // fprintf(FMCS," q2 A%d -1.\n q2 B%d 1.\n",//---stampaggi
7473 // i,i);//---stampaggi
7474  Coefficients[3*NStructRowsMax+ii]= -1.;
7475  Coefficients[3*NStructRowsMax+ii+1]= 1.;
7476  ii += 2;
7477  } else {
7478 // fprintf(FMCS," q2 Ap%d -1. Am%d -1.\n q2 Bp%d 1. Bm%d 1.\n",//---stampaggi
7479 // i,i,i,i);//---stampaggi
7480  Coefficients[3*NStructRowsMax+ii]= -1.;
7481  Coefficients[3*NStructRowsMax+ii+1]= -1.;
7482  Coefficients[3*NStructRowsMax+ii+2]= 1.;
7483  Coefficients[3*NStructRowsMax+ii+3]= 1.;
7484  ii += 4;
7485  }
7486 
7487  }
7488 
7489 // Column variable lambdap(i)
7490  for(i=0 ; i< NpointsInFit ; i++) {
7491  ii=(4+i)*NStructRowsMax;
7492  Coefficients[ii]= -M;
7493  Coefficients[ii+1]= -M;
7494  Coefficients[ii+2]= -M;
7495  Coefficients[ii+3]= M;
7496 // if( mvdhit[i]){
7497 // fprintf(FMCS," lam%d A%d %g B%d %g\n lam%d C%d %g D%d %g\n",//---stampaggi
7498 // i,i,-M,i,-M, i , i,-M, i, M);//---stampaggi
7499 // } else {
7500 // fprintf(FMCS," lamp%d Ap%d %g Bp%d %g\n lamp%d Cp%d %g Dp%d %g\n lamp%d LAMBDA%d 1.\n",//---stampaggi
7501 // i,i,-M,i,-M, i , i,-M, i, M, i,i);//---stampaggi
7502 // }
7503 
7504  if(! mvdhit[i]) Coefficients[ii+4]= 1.;
7505 
7506  }
7507 
7508 
7509 
7510 // Column variable lambdam(i)
7511  for(i=0 ; i< NpointsInFit ; i++) {
7512  if( mvdhit[i]) continue;
7513  ii+= NStructRowsMax;
7514 // fprintf(FMCS," lamm%d Am%d %g Bm%d %g\n lamm%d Cm%d %g Dm%d %g\n lamm%d LAMBDA%d 1.\n",//---stampaggi
7515 // i,i,-M,i,-M, i,i , -M, i, M, i,i);//---stampaggi
7516  Coefficients[ii]= -M;
7517  Coefficients[ii+1]= -M;
7518  Coefficients[ii+2]= -M;
7519  Coefficients[ii+3]= M;
7520  Coefficients[ii+4]= 1.;
7521  }
7522 // Column variable sigmap(i)
7523  for(i=0; i< NpointsInFit ; i++) {
7524  ii+= NStructRowsMax;
7525 
7526 /*
7527  if( mvdhit[i]){
7528  fprintf(FMCS," sigma%d OBJECT %g A%d -1.\n sigma%d B%d -1. C%d 1.\n sigma%d D%d -1.\n",//---stampaggi
7529  i,1./Delta[i],i,i,i,i,i,i);//---stampaggi
7530 
7531  } else {
7532  fprintf(FMCS," sigmap%d OBJECT %g Ap%d -1.\n sigmap%d Bp%d -1. Cp%d 1.\n sigmap%d Dp%d -1.\n",//---stampaggi
7533  i,1./Delta[i],i,i,i,i,i,i);//---stampaggi
7534  }
7535 */
7536 
7537  Coefficients[ii]= 1./Delta[i];
7538  Coefficients[ii+1]= -1.;
7539  Coefficients[ii+2]= -1.;
7540  Coefficients[ii+3]= 1.;
7541  Coefficients[ii+4]= -1.;
7542 
7543 
7544  }
7545 // Column variable sigmam(i)
7546  for(i=0 ; i< NpointsInFit ; i++) {
7547  if( mvdhit[i])continue;
7548  ii+= NStructRowsMax;
7549 // fprintf(FMCS," sigmam%d OBJECT %g Am%d -1.\n sigmam%d Bm%d -1. Cm%d 1.\n sigmam%d Dm%d -1.\n",//---stampaggi
7550 // i,1./Delta[i],i,i,i,i,i,i);//---stampaggi
7551  Coefficients[ii]= 1./Delta[i];
7552  Coefficients[ii+1]= -1.;
7553  Coefficients[ii+2]= -1.;
7554  Coefficients[ii+3]= 1.;
7555  Coefficients[ii+4]= -1.;
7556  }
7557 
7558 // Column variable DUMMY
7559 //-----------stampaggi
7560 /*
7561  for(i=0 ; i< NpointsInFit ; i++) {
7562  if( mvdhit[i]){
7563  fprintf(FMCS," DUMMY A%d 1.\n DUMMY B%d 1.\n DUMMY C%d 1.\n",i,i,i);
7564  fprintf(FMCS," DUMMY D%d 1.\n",i);
7565  } else {
7566  fprintf(FMCS," DUMMY Ap%d 1. Am%d 1.\n DUMMY Bp%d 1. Bm%d 1.\n DUMMY Cp%d 1. Cm%d 1\n",
7567  i,i,i,i,i,i);
7568  fprintf(FMCS," DUMMY Dp%d 1. Dm%d 1.\n",i,i);
7569  }
7570  }
7571 */
7572 //---fine stampaggi
7573  ii+= NStructRowsMax;
7574  for(i=0, iii=0 ; i< NpointsInFit ; i++) {
7575  if( mvdhit[i]){
7576  Coefficients[ii+iii]= 1.;
7577  Coefficients[ii+iii+1]= 1.;
7578  Coefficients[ii+iii+2]= 1.;
7579  Coefficients[ii+iii+3]= 1.;
7580  iii +=4;
7581  } else {
7582  Coefficients[ii+iii]= 1.;
7583  Coefficients[ii+iii+1]= 1.;
7584  Coefficients[ii+iii+2]= 1.;
7585  Coefficients[ii+iii+3]= 1.;
7586  Coefficients[ii+iii+4]= 1.;
7587  Coefficients[ii+iii+5]= 1.;
7588  Coefficients[ii+iii+6]= 1.;
7589  Coefficients[ii+iii+7]= 1.;
7590  iii +=8;
7591  }
7592  }
7593 
7594 //-----------
7595 
7596 //--- give the names to the Structural Variables
7597 
7598  sprintf(&auxStructVarName[0][0],"m1",i);
7599  StructVarName[0] = &auxStructVarName[0][0];
7600  sprintf(&auxStructVarName[1][0],"m2",i);
7601  StructVarName[1] = &auxStructVarName[1][0];
7602 
7603  sprintf(&auxStructVarName[2][0],"q1",i);
7604  StructVarName[2] = &auxStructVarName[2][0];
7605 
7606  sprintf(&auxStructVarName[3][0],"q2",i);
7607  StructVarName[3] = &auxStructVarName[3][0];
7608  for(i=0, ii=0; i< NpointsInFit ; i++) {
7609  if( mvdhit[i]){
7610  sprintf(&auxStructVarName[4+i][0],"lam%d",i);
7611  StructVarName[4+i] = &auxStructVarName[4+i][0];
7612 
7613  sprintf(&auxStructVarName[4+nMvdHits+2*nSttHits+i][0],"sigma%d",i);
7614  StructVarName[4+nMvdHits+2*nSttHits+i] = &auxStructVarName[4+nMvdHits+2*nSttHits+i][0];
7615  } else {
7616  sprintf(&auxStructVarName[4+i][0],"lamp%d",i);
7617  StructVarName[4+i] = &auxStructVarName[4+i][0];
7618 
7619  sprintf(&auxStructVarName[4+NpointsInFit+ii][0],"lamm%d",i);
7620  StructVarName[4+NpointsInFit+ii] = &auxStructVarName[4+NpointsInFit+ii][0];
7621 
7622  sprintf(&auxStructVarName[4+nMvdHits+2*nSttHits+i][0],"sigmap%d",i);
7623  StructVarName[4+nMvdHits+2*nSttHits+i] = &auxStructVarName[4+nMvdHits+2*nSttHits+i][0];
7624 
7625  sprintf(&auxStructVarName[4+NpointsInFit+nMvdHits+2*nSttHits+ii][0],"sigmam%d",i);
7626  StructVarName[4+NpointsInFit+nMvdHits+2*nSttHits+ii] =
7627  &auxStructVarName[4+NpointsInFit+nMvdHits+2*nSttHits+ii][0];
7628  ii++;
7629  }
7630  }
7631 
7632 
7633  sprintf(&auxStructVarName[NStructVar-1][0],"DUMMY",i);
7634  StructVarName[NStructVar-1] = &auxStructVarName[NStructVar-1][0];
7635 
7636 
7637 
7638 //--- give the names of those Rows in which the Structural Variables are present
7639 
7640 // for m1, m2, q1, q2
7641  for(i=0; i< 4; i++){
7642  for(j=0, ii=0; j< NpointsInFit;j++){
7643  if( mvdhit[j]){
7644  sprintf(&aux[i*NStructRowsMax+ii][0],"A%d",j);
7645  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii]=&aux[i*NStructRowsMax+ii][0];
7646  sprintf(&aux[i*NStructRowsMax+ii+1][0],"B%d",j);
7647  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+1]=&aux[i*NStructRowsMax+ii+1][0];
7648  ii += 2;
7649  } else {
7650  sprintf(&aux[i*NStructRowsMax+ii][0],"Ap%d",j);
7651  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii]=&aux[i*NStructRowsMax+ii][0];
7652  sprintf(&aux[i*NStructRowsMax+ii+1][0],"Am%d",j);
7653  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+1]=&aux[i*NStructRowsMax+ii+1][0];
7654  sprintf(&aux[i*NStructRowsMax+ii+2][0],"Bp%d",j);
7655  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+2]=&aux[i*NStructRowsMax+ii+2][0];
7656  sprintf(&aux[i*NStructRowsMax+ii+3][0],"Bm%d",j);
7657  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+3]=&aux[i*NStructRowsMax+ii+3][0];
7658  ii += 4;
7659  }
7660  }
7661  }
7662 
7663 // now for the lamp* variables
7664  for(i=0; i< NpointsInFit;i++){
7665  if( mvdhit[i]){
7666  sprintf(&aux[(i+4)*NStructRowsMax+0][0],"A%d",i);
7667  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+0]= &aux[(i+4)*NStructRowsMax+0][0];
7668  sprintf(&aux[(i+4)*NStructRowsMax+1][0],"B%d",i);
7669  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+1]= &aux[(i+4)*NStructRowsMax+1][0];
7670  sprintf(&aux[(i+4)*NStructRowsMax+2][0],"C%d",i);
7671  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+2]= &aux[(i+4)*NStructRowsMax+2][0];
7672  sprintf(&aux[(i+4)*NStructRowsMax+3][0],"D%d",i);
7673  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+3]= &aux[(i+4)*NStructRowsMax+3][0];
7674  } else {
7675  sprintf(&aux[(i+4)*NStructRowsMax+0][0],"Ap%d",i);
7676  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+0]= &aux[(i+4)*NStructRowsMax+0][0];
7677  sprintf(&aux[(i+4)*NStructRowsMax+1][0],"Bp%d",i);
7678  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+1]= &aux[(i+4)*NStructRowsMax+1][0];
7679  sprintf(&aux[(i+4)*NStructRowsMax+2][0],"Cp%d",i);
7680  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+2]= &aux[(i+4)*NStructRowsMax+2][0];
7681  sprintf(&aux[(i+4)*NStructRowsMax+3][0],"Dp%d",i);
7682  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+3]= &aux[(i+4)*NStructRowsMax+3][0];
7683  sprintf(&aux[(i+4)*NStructRowsMax+4][0],"LAMBDA%d",i);
7684  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+4]= &aux[(i+4)*NStructRowsMax+4][0];
7685  }
7686  }
7687 
7688 // now for the lamm* variables
7689  for(i=0, ii=0; i< NpointsInFit;i++){
7690  if( mvdhit[i]) continue;
7691  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax][0],"Am%d",i);
7692  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax]=
7693  &aux[(ii+4+NpointsInFit)*NStructRowsMax][0];
7694  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+1][0],"Bm%d",i);
7695  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+1]=
7696  &aux[(ii+4+NpointsInFit)*NStructRowsMax+1][0];
7697  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+2][0],"Cm%d",i);
7698  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+2]=
7699  &aux[(ii+4+NpointsInFit)*NStructRowsMax+2][0];
7700  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+3][0],"Dm%d",i);
7701  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+3]=
7702  &aux[(ii+4+NpointsInFit)*NStructRowsMax+3][0];
7703  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+4][0],"LAMBDA%d",i);
7704  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+4]=
7705  &aux[(ii+4+NpointsInFit)*NStructRowsMax+4][0];
7706  ii++;
7707  }
7708 
7709 // now for the sigmap* variables
7710  for(i=0; i< NpointsInFit;i++){
7711  if( mvdhit[i]) {
7712 // sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT",i);
7713  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT");
7714  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax]=
7715  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0];
7716  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0],"A%d",i);
7717  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1]=
7718  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0];
7719  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0],"B%d",i);
7720  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2]=
7721  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0];
7722  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0],"C%d",i);
7723  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3]=
7724  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0];
7725  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0],"D%d",i);
7726  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4]=
7727  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0];
7728  } else {
7729 // sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT",i);
7730  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT");
7731  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax]=
7732  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0];
7733  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0],"Ap%d",i);
7734  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1]=
7735  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0];
7736  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0],"Bp%d",i);
7737  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2]=
7738  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0];
7739  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0],"Cp%d",i);
7740  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3]=
7741  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0];
7742  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0],"Dp%d",i);
7743  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4]=
7744  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0];
7745  }
7746  }
7747 
7748 // now for the sigmam* variables
7749  for(i=0, ii=0; i< NpointsInFit;i++){
7750  if( mvdhit[i]) continue;
7751 // sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT",i);
7752  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT");
7753  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax]=
7754  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax][0];
7755 
7756  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+1][0],"Am%d",i);
7757  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+1]=
7758  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+1][0];
7759 
7760  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+2][0],"Bm%d",i);
7761  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+2]=
7762  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+2][0];
7763 
7764  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+3][0],"Cm%d",i);
7765  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+3]=
7766  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+3][0];
7767 
7768  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+4][0],"Dm%d",i);
7769  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+4]=
7770  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+4][0];
7771  ii++;
7772  }
7773 
7774 // now for the DUMMY variable
7775  for(i=0, ii=0; i< NpointsInFit;i++){
7776  if( mvdhit[i]) {
7777  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii][0],"A%d",i);
7778  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii]=
7779  &aux[(NStructVar-1)*NStructRowsMax+ii][0];
7780 
7781  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+1][0],"B%d",i);
7782  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+1]=
7783  &aux[(NStructVar-1)*NStructRowsMax+ii+1][0];
7784 
7785  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+2][0],"C%d",i);
7786  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+2]=
7787  &aux[(NStructVar-1)*NStructRowsMax+ii+2][0];
7788 
7789  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+3][0],"D%d",i);
7790  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+3]=
7791  &aux[(NStructVar-1)*NStructRowsMax+ii+3][0];
7792  ii += 4;
7793  } else {
7794  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii][0],"Ap%d",i);
7795  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii]=
7796  &aux[(NStructVar-1)*NStructRowsMax+ii][0];
7797 
7798  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+1][0],"Am%d",i);
7799  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+1]=
7800  &aux[(NStructVar-1)*NStructRowsMax+ii+1][0];
7801 
7802  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+2][0],"Bp%d",i);
7803  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+2]=
7804  &aux[(NStructVar-1)*NStructRowsMax+ii+2][0];
7805 
7806  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+3][0],"Bm%d",i);
7807  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+3]=
7808  &aux[(NStructVar-1)*NStructRowsMax+ii+3][0];
7809  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+4][0],"Cp%d",i);
7810  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+4]=
7811  &aux[(NStructVar-1)*NStructRowsMax+ii+4][0];
7812 
7813  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+5][0],"Cm%d",i);
7814  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+5]=
7815  &aux[(NStructVar-1)*NStructRowsMax+ii+5][0];
7816 
7817  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+6][0],"Dp%d",i);
7818  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+6]=
7819  &aux[(NStructVar-1)*NStructRowsMax+ii+6][0];
7820 
7821  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+7][0],"Dm%d",i);
7822  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+7]=
7823  &aux[(NStructVar-1)*NStructRowsMax+ii+7][0];
7824  ii += 8;
7825  }
7826  }
7827 
7828 
7829 
7830 //----------------- write the RHS section
7831 
7832 // fprintf(FMCS,"RHS\n");//---stampaggi
7833  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
7834  if( mvdhit[i]){
7835 //---stampaggi
7836 /*
7837  fprintf(FMCS," BOUND A%d %g B%d %g\n BOUND C%d %g D%d %g\n",
7838  i, Oy[i]+2.*M,i,
7839  -Oy[i]+2.*M,i,
7840  Delta[i]+2.*M,i,M-Delta[i]+2.*M);
7841 */
7842 //---fine stampaggi
7843  ValueB[ii] = Oy[i]+2.*M;
7844  ValueB[ii+1]= -Oy[i]+2.*M;
7845  ValueB[ii+2]= Delta[i]+2.*M;
7846  ValueB[ii+3]= M-Delta[i]+2.*M;
7847  ii += 4;
7848  } else {
7849 //---stampaggi
7850 /*
7851  fprintf(FMCS," BOUND Ap%d %g Bp%d %g\n BOUND Cp%d %g Dp%d %g\n",
7852  i, Oy[i]+DriftRadiusconformal[ i ]+2.*M,i,
7853  -Oy[i]-DriftRadiusconformal[ i ]+2.*M,i,
7854  Delta[i]+2.*M,i,M-Delta[i]+2.*M);
7855 */
7856 //---fine stampaggi
7857  ValueB[ii] = Oy[i]+DriftRadiusconformal[ i ]+2.*M;
7858  ValueB[ii+1]= -Oy[i]-DriftRadiusconformal[ i ]+2.*M;
7859  ValueB[ii+2]= Delta[i]+2.*M;
7860  ValueB[ii+3]= M-Delta[i]+2.*M;
7861 
7862 
7863 //---stampaggi
7864 /*
7865  fprintf(FMCS," BOUND Am%d %g Bm%d %g\n BOUND Cm%d %g Dm%d %g\n",
7866  i, Oy[i]-DriftRadiusconformal[ i ]+2.*M,i,
7867  -Oy[i]+DriftRadiusconformal[ i ]+2.*M,i,
7868  Delta[i]+2.*M,i,M-Delta[i]+2.*M);
7869  fprintf(FMCS," BOUND LAMBDA%d 1.\n",i);
7870 */
7871 //---fine stampaggi
7872  ValueB[ii+4]= Oy[i]-DriftRadiusconformal[ i ]+2.*M;
7873  ValueB[ii+5]= -Oy[i]+DriftRadiusconformal[ i ]+2.*M;
7874  ValueB[ii+6]= Delta[i]+2.*M;
7875  ValueB[ii+7]= M-Delta[i]+2.*M;
7876  ValueB[ii+8]= 1.;
7877  ii +=9;
7878  }
7879 
7880  }
7881 
7882 
7883 //----------------- write the RANGES section
7884 
7885 // fprintf(FMCS,"RANGES\n");//---stampaggi
7886  for(i=0 , ii=0; i< NpointsInFit ; i++) {
7887  if( mvdhit[i]) continue;
7888 // fprintf(FMCS," RANGE LAMBDA%d 1.\n",i);//---stampaggi
7889 //---
7890  ValueRanges[ii]=1.;
7891  sprintf(&auxNameRanges[ii][0],"LAMBDA%d",i);
7892  NameRanges[ii]=&auxNameRanges[ii][0];
7893  ii++;
7894  }
7895 
7896 //----------------- write the BOUNDS section
7897 // fprintf(FMCS,"BOUNDS\n");//---stampaggi
7898 
7899 
7900  for(i=0 ; i< NpointsInFit ; i++) {
7901  if( mvdhit[i]){
7902 // fprintf(FMCS," BV Bounds lam%d\n", i);//---stampaggi
7903  sprintf(&auxTypeofBound[i][0],"BV"); TypeofBound[i]= &auxTypeofBound[i][0];
7904  sprintf(&auxBoundStructVarName[i][0],"lam%d",i);
7905  } else {
7906 // fprintf(FMCS," BV Bounds lamp%d\n", i);//---stampaggi
7907  sprintf(&auxTypeofBound[i][0],"BV"); TypeofBound[i]= &auxTypeofBound[i][0];
7908  sprintf(&auxBoundStructVarName[i][0],"lamp%d",i);
7909  }
7910 
7911  BoundStructVarName[i]=&auxBoundStructVarName[i][0];
7912  BoundValue[i]=0.;
7913 
7914  }
7915 
7916  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
7917  if( mvdhit[i]) continue;
7918 // fprintf(FMCS," BV Bounds lamm%d\n", i);//---stampaggi
7919  sprintf(&auxTypeofBound[ii+NpointsInFit][0],"BV");
7920  TypeofBound[ii+NpointsInFit]= &auxTypeofBound[ii+NpointsInFit][0];
7921  sprintf(&auxBoundStructVarName[ii+NpointsInFit][0],"lamm%d",i);
7922  BoundStructVarName[ii+NpointsInFit]=&auxBoundStructVarName[ii+NpointsInFit][0];
7923  BoundValue[ii+NpointsInFit]=0.;
7924  ii++;
7925  }
7926 
7927 // fprintf(FMCS," FX Bounds DUMMY %g\n",2.*M);//--stampaggi
7928  sprintf(&auxTypeofBound[NpointsInFit+nSttHits][0],"FX");
7929  TypeofBound[NpointsInFit+nSttHits]= &auxTypeofBound[NpointsInFit+nSttHits][0];
7930 
7931  sprintf(&auxTypeofBound[NpointsInFit+nSttHits][0],"FX");
7932  TypeofBound[NpointsInFit+nSttHits]= &auxTypeofBound[NpointsInFit+nSttHits][0];
7933 
7934  sprintf(&auxBoundStructVarName[NpointsInFit+nSttHits][0],"DUMMY");
7935  BoundStructVarName[NpointsInFit+nSttHits]=
7936  &auxBoundStructVarName[NpointsInFit+nSttHits][0];
7937  BoundValue[NpointsInFit+nSttHits]=2.*M;
7938 //-----
7939 
7940 //------------------------------------------------------------stampaggi
7941 /*
7942  fprintf(FMCS,"ENDATA\n");
7943  fclose(FMCS);
7944 */
7945 
7946 if(istampa>=4){
7947 
7948 cout<<"n. punti nel fit "<<NpointsInFit<<endl;
7949 
7950 
7951 cout<<"nRows "<<nRows<<endl;
7952 for(int ic =0;ic<nRows; ic++){
7953  cout<<"n. Row "<<ic<<", nameRows "<<nameRows[ic]<<", typeRows "<<typeRows[ic]<<endl;
7954 }
7955 
7956 cout<<"NStructRowsMax, NStructVar "<<NStructRowsMax<<", "<<NStructVar<<endl;
7957 for(int ic =0;ic<NStructVar; ic++){
7958  cout<<"NRowsInWhichStructVarArePresent "<<NRowsInWhichStructVarArePresent[ic]
7959  <<", nome var. strut. n."<<ic<<" = "
7960  <<StructVarName[ic]<<endl;
7961 
7962  for(int jc=0; jc<NRowsInWhichStructVarArePresent[ic];jc++){
7963  cout<<"n. "<<jc<<" NameRowsInWhichStructVarArePresent "
7964  <<NameRowsInWhichStructVarArePresent[ic*NStructRowsMax+jc]<<endl;
7965  }
7966 }
7967 
7968 
7969 cout<<"n Coefficient "<<21*nMvdHits+24*nSttHits<<endl;
7970 iii=0;
7971 for(int ic =0;ic<NStructVar; ic++){
7972  cout<<"Struct. Var."<< StructVarName[ic] <<" e' presente in "
7973  << NRowsInWhichStructVarArePresent[ic]<<" Rows;"<<endl;
7974  for(ii=0;ii<NRowsInWhichStructVarArePresent[ic];ii++){
7975 
7976  cout<<"\tin Row "<<NameRowsInWhichStructVarArePresent[ic*NStructRowsMax+ii]
7977  <<", ha Coefficient "<<Coefficients[ic*NStructRowsMax+ii]<<
7978  " (n. sequenziale = "<<iii<<")"<<endl;
7979  iii++;
7980  }
7981 }
7982 
7983 cout<<"n valuesB "<<nRows-1<<endl;
7984 for(int ic =0;ic<nRows-1; ic++){
7985  cout<<"n. "<<ic<<", valuesB "<<ValueB[ic]<<endl;
7986 }
7987 cout<<"n ranges "<<nRanges<<endl;
7988 for(int ic =0;ic<nRanges; ic++){
7989  cout<<"n. "<<ic<<", RANGES "<<ValueRanges[ic]<<endl;
7990 }
7991 cout<<"n Bounds "<<nBounds<<endl;
7992 for(int ic =0;ic<nBounds; ic++){
7993  cout<<"n. "<<ic<<", Bounds "<<BoundValue[ic]<<endl;
7994  cout<<"n. "<<ic<<", Bound Type "<<TypeofBound[ic]<<endl;
7995  cout<<"n. "<<ic<<", Bound Name "<<BoundStructVarName[ic]<<endl;
7996 }
7997  } // end of if(istampa
7998 
7999 //-------fine stampaggi
8000 
8001 //----------------------- funzioni chiamate direttamente
8002 /*
8003 cout<<"cavolo, da sttmvdtracking : nRows = "<<nRows<<", NStructVar = "<<
8004  NStructVar<<", NStructRowsMax = "<<NStructRowsMax<<
8005  ", NRowsInWhichStructVarArePresent = "<<
8006  NRowsInWhichStructVarArePresent<<", nRanges = "<<nRanges
8007  <<", nBounds = "<<nBounds<<endl;
8008 */
8009  int status= glp_main(
8010  nRows,nameRows,typeRows, // ROWS info
8011  NStructVar, NStructRowsMax, NRowsInWhichStructVarArePresent, // COLUMNS info
8012  StructVarName, NameRowsInWhichStructVarArePresent, // COLUMNS info
8013  Coefficients, // COLUMNS info
8014  ValueB, // RHS info
8015  nRanges, ValueRanges, NameRanges, // RANGES info
8016  nBounds, BoundValue, BoundStructVarName, TypeofBound // BOUNDS info
8017 // ,final_values,TIMEOUT
8018  ,final_values
8019  );
8020  if(status != 0) return -5 ;
8021 
8022 
8023 //--------stampaggi
8024 if(istampa>=3){
8025 printf("from FitHelixCylinder printout dopo glp_main -------------------------------\n");
8026 printf(" number of structural variables %d\n",NStructVar);
8027 int ica;
8028 for(ica=0;ica<NStructVar;ica++){
8029  printf("name of structural variable %s and its final value %g\n",
8030  StructVarName[ica], final_values[ica]);
8031 }
8032 printf("from FitHelixCylinder printout dopo glp_main -------------------------------\n");
8033 } // end of if(istampa
8034 //--------fine stampaggi
8035 
8036 
8037 
8038 //----------------------- fine funzioni chiamate direttamente
8039 
8040 
8041 /*
8042  if(istampa>=3 && IVOLTE <= 20){
8043  sprintf(stringa,
8044 "/home/boca/panda/glpk/glpk-4.39/examples/glpsol --min -o soluztrack%dEvent%dstep%d GeneralParallelHitsConformeTraccia%dEvent%d.mcs",
8045  0,IVOLTE,1,0,IVOLTE);
8046  } else {
8047  sprintf(stringa,
8048 "/home/boca/panda/glpk/glpk-4.39/examples/glpsol --min -o soluztrack%dEvent%dstep%d GeneralParallelHitsConformeTraccia%dEvent%d.mcs >& /dev/null",
8049  0, IVOLTE,1,0,IVOLTE,1);
8050  }
8051 */
8052 
8053  m1_result = final_values[0];
8054  m2_result = final_values[1];
8055  q1_result = final_values[2];
8056  q2_result = final_values[3];
8057 
8058 if(istampa>2) cout<<"Results : m1 = "<<m1_result<<", m2= "<<m2_result<<", q1 = "<<q1_result<<
8059  ", q2 = "<<q2_result<<endl;
8060 
8061 //--------- case in which the fit failed
8062  if( final_values[0]==0. && final_values[1]==0. && final_values[2]==0. &&final_values[3]==0. )
8063  return -10;
8064 
8065 //------------------------ transformation of the result in terms of ALFA, BETA, GAMMA
8066 
8067 
8068  *qu = q1_result - q2_result;
8069  *emme = m1_result-m2_result ;
8070 
8071  *pGamma = 0.;
8072  if( fabs( *qu ) > 1.e-10) { // trajectory is a circle in XY space
8073  *pAlfa = *emme/(*qu);
8074  *pBeta = -1./(*qu);
8075  *Type=true;
8076 // now take into account the rotation and correct; the only affected quantities are ALFA and BETA
8077  alfetta = *pAlfa;
8078  *pAlfa = *pAlfa*cose - *pBeta*sine;
8079  *pBeta = alfetta*sine + *pBeta*cose;
8080 
8081 
8082  } else if(fabs(*emme)> 1.e-10) {// trajectory is a straight line in XY space of equation y= m*x
8083  // the rotation first
8084  angle = atan(*emme) + rotationangle;
8085  if( fabs(cos(angle)) > 1.e-10 ) {
8086  *pAlfa = 999999.;
8087  *pBeta = -(*pAlfa)/tan(angle);
8088  *Type=false;
8089 
8090  } else { // in this case the equation in XY plane is y = 0.
8091  *pAlfa = 0.;
8092  *pBeta = 999999.;
8093  *Type=false;
8094  }
8095  } else { // in this case also the equation in XY plane is y = 0.
8096  *pAlfa = 0.;
8097  *pBeta = 999999.;
8098  *Type=false;
8099  } // end of if( fabs( *qu ) > 1.e-10)
8100 
8101 //------------------
8102 
8103 
8104 // now take into account the displacement and correct
8105  *pGamma += (trajectory_vertex[0]*trajectory_vertex[0]+
8106  trajectory_vertex[1]*trajectory_vertex[1]
8107  -*pAlfa*trajectory_vertex[0]-*pBeta*trajectory_vertex[1]);
8108  *pAlfa -= 2.*trajectory_vertex[0];
8109  *pBeta -= 2.*trajectory_vertex[1];
8110 
8111 
8112  if(fabs(cose-*emme*sine)> 1.e-10) {
8113  *qu=*qu/(cose-*emme*sine);
8114  *emme=(*emme*cose+sine)/(cose-*emme*sine);
8115  return 1;
8116  } else { // in this case the equation is 0 = x+*qu .
8117  if(fabs(sine+*emme*cose) < 1.e-10) {
8118  cout<<" From FitHelixCylinder, equation of XY circle : X**2 + Y**2 =0,"
8119  <<" situation impossible in principle! Returning -1"
8120  <<endl;
8121  return -1;
8122  }
8123 
8124  *emme=1.;
8125  *qu = *qu/(sine+*emme*cose);
8126  return 99; // in this case the equation is 0 = x+*qu .
8127  }
8128 
8129 
8130 
8131 
8132 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
Int_t i
Definition: run_full.C:25
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Double_t PI
Double_t angle
int status[10]
Definition: f_Init.h:28
Short_t PndSttTrackFinderReal::FitSZspace ( Short_t  nSkewHitsinTrack,
Double_t S,
Double_t Z,
Double_t DriftRadius,
Double_t ErrorDriftRadius,
Double_t  FInot,
Short_t  NMAX,
Double_t emme 
)
private

Definition at line 8146 of file PndSttTrackFinderReal.cxx.

References angle, cos(), Double_t, fabs(), i, istampa, IVOLTE, n, PI, printf(), sin(), and status.

Referenced by DoFind().

8156 {
8157 
8158 
8159  // definition of variables for the glpsol solver
8160  // ROWS (for read_rows function)
8161  //
8162  Short_t NpointsInFit = nSkewHitsinTrack-NMAX <0 ? nSkewHitsinTrack : NMAX;
8163 
8164 
8165  bool mvdhit[NpointsInFit];
8166 
8167 
8168 
8169 
8170  Double_t ave,
8171  avex,
8172  avey,
8173  cose,
8174  sine,
8175  M = 50.,
8176  m_result,
8177  q_result,
8178  A,
8179  alfetta,
8180  angle,
8181  offsety,
8182  rotationangle,
8183  Ox[NpointsInFit],
8184  Oy[NpointsInFit],
8185  Delta[NpointsInFit];
8186 
8187  Short_t i, j, ii, iii, n, nSttHits, nMvdHits;
8188  Short_t Status;
8189 
8190  char nome[300], stringa[300], stringa2[300];
8191  float m1_result,m2_result, q1_result,q2_result, A1_result, A2_result;
8192 
8193 // --
8194 
8195  if(nSkewHitsinTrack==0) {
8196  cout<<"from FitSZspace, Evento "<<IVOLTE<<endl;
8197  cout<<"from PndSttTrackFinderReal::FitSZspace : no points in fit, return!\n";
8198  return -10;
8199  }
8200 
8201 
8202 
8203 
8204 
8205 // use the trick of increasing the rotation angle by 10 degrees in order to
8206 // obtain always a positive m
8207 // rotationangle -= PI/18.;
8208  rotationangle = PI/2.;
8209 
8210 
8211  cose = cos(rotationangle);
8212  sine = sin(rotationangle);
8213 
8214  nSttHits = nMvdHits = 0;
8215 
8216  for(i=0;i<NpointsInFit; i++){
8217  Ox[i] = Z[i]*cose +(S[i] - FInot)*sine;
8218  Oy[i] = -Z[i]*sine +(S[i] - FInot)*cose;
8219  Delta[i] = ErrorDriftRadius[i];
8220 
8221  if( DriftRadius[ i ]<0. ) // not a STT hit.
8222  {
8223  mvdhit[i]=true;
8224  nMvdHits++;
8225  } else {
8226  mvdhit[i]=false;
8227  nSttHits++;
8228  }
8229  } // end of for(i=0;i<NpointsInFit; i++)
8230 
8231 
8232 
8233 
8234 
8235 //--------- calculation of # structural variables (see Gianluigi's logbook pag. 236) etc.etc.
8236 
8237  int NStructVar = 4 + 1 + nMvdHits * 2 + nSttHits *4 ;
8238 // m1,m2,q1,q2 DUMMY lam & sigma lamp & lamm & sigmap & sigmam
8239 
8240 
8241  int nRows = 1 + nMvdHits * 4 + nSttHits * 9;
8242 // OBJECT A,B,C,D Ap,Bp,Cp,Dp,Am,Bm,Cm,Dm,LAMBDA
8243 
8244 //---- creating the various service arrays
8245  int typeRows[nRows];
8246  char * nameRows[nRows];
8247  char auxnameRows[nRows][20];
8248 
8249  int NStructRowsMax = 8*NpointsInFit ; // maximum number of ROWS in which a
8250  // structural variable (for instance M ) can be found
8251  double final_values[NStructVar];
8252  int NRowsInWhichStructVarArePresent[NStructVar];
8253  char *StructVarName[NStructVar];
8254  char auxStructVarName[NStructVar][20];
8255  char *NameRowsInWhichStructVarArePresent[NStructVar*NStructRowsMax];
8256  char aux[NStructVar*NStructRowsMax][20];
8257  double Coefficients[NStructVar*NStructRowsMax];
8258 
8259  //--------for RHS information
8260  double ValueB[nRows-1]; // -1 because OBJECT dowsn't have a RHS boundary.
8261  //--------for RANGES information
8262  int nRanges = nSttHits;
8263  double ValueRanges[nRanges];
8264  char *NameRanges[nRanges];
8265  char auxNameRanges[nRanges][20];
8266 
8267  //--------for BOUNDS information
8268  int nBounds=NpointsInFit+nSttHits+1+2;// +2 because q1 = q2 = 0 fixed.
8269  double BoundValue[nBounds];
8270  char *BoundStructVarName[nBounds];
8271  char auxBoundStructVarName[nBounds][20];
8272  char *TypeofBound[nBounds];
8273  char auxTypeofBound[nBounds][20];
8274  //--------end BOUNDS information
8275 
8276 //---------------------------------------------------
8277 
8278 
8279 
8280 
8281 //--- calculate array NRowsInWhichStructVarArePresent
8282  NRowsInWhichStructVarArePresent[0] = // this is for m1
8283  NRowsInWhichStructVarArePresent[1] = // this is for m2
8284  NRowsInWhichStructVarArePresent[2] = // this is for q1
8285  NRowsInWhichStructVarArePresent[3] = nMvdHits*2 + nSttHits *4; // this is for q2
8286  //--- the following is for the lam* (Mvd Hits) and lamp* (Stt hits) structural variables
8287  for(i=0,ii=0; i< NpointsInFit ; i++) {
8288  if( mvdhit[i]){
8289  NRowsInWhichStructVarArePresent[4+ii]= 4;
8290  } else {
8291  NRowsInWhichStructVarArePresent[4+ii]= 5;
8292  }
8293  ii++;
8294  }
8295 
8296  // the lamm* (Stt hits) if any.
8297  for(i=0; i< NpointsInFit ; i++) {
8298  if( !mvdhit[i]){
8299  NRowsInWhichStructVarArePresent[4+ii]= 5;
8300  ii++;
8301  }
8302  }
8303 
8304 
8305 
8306 
8307 
8308  //--- the following is for the sigma structural variables
8309  for(i=0 ; i< nMvdHits+2*nSttHits ; i++) {
8310  NRowsInWhichStructVarArePresent[4+ii+i]= 5;
8311  }
8312 //--- the following is for the DUMMY structural variable
8313  NRowsInWhichStructVarArePresent[4+ii+nMvdHits+2*nSttHits]= nMvdHits*4 + nSttHits*8;
8314 
8315 
8316 
8317 
8318 //----------------- write the ROWS section
8319 
8320 
8321 //-------stampaggi
8322 /*
8323  sprintf(nome,"GeneralSkewEvent%d.mcs", IVOLTE);
8324  FILE * FMCS = fopen(nome,"w");
8325  fprintf(FMCS,"NAME FIT\n");
8326 
8327 
8328  fprintf(FMCS,"ROWS\n");
8329  fprintf(FMCS," N OBJECT\n");
8330  for(i=0 ; i< NpointsInFit ; i++) {
8331  if( mvdhit[i]){
8332  fprintf(FMCS," L A%d\n L B%d\n L C%d\n L D%d\n",i,i,i,i);
8333  }else{
8334  fprintf(FMCS," L Ap%d\n L Bp%d\n L Cp%d\n L Dp%d\n",i,i,i,i);
8335  fprintf(FMCS," L Am%d\n L Bm%d\n L Cm%d\n L Dm%d\n G LAMBDA%d\n",i,i,i,i,i);
8336  }
8337  }
8338 */
8339 //--------------------------fine stampaggi
8340 
8341 
8342 
8343 
8344  sprintf(&(auxnameRows[0][0]),"OBJECT");
8345  nameRows[0]=&auxnameRows[0][0];
8346  typeRows[0]=GLP_FR;
8347  for(i=0 , ii=0 ; i< NpointsInFit ; i++) {
8348 
8349  if( mvdhit[i]){
8350  typeRows[1+ii]=GLP_UP;typeRows[2+ii]=GLP_UP;typeRows[3+ii]=GLP_UP;typeRows[4+ii]=GLP_UP;
8351  typeRows[5+ii]=GLP_LO;
8352 
8353  sprintf(&(auxnameRows[1+ii][0]),"A%d",i); nameRows[1+ii]=&auxnameRows[1+ii][0];
8354  sprintf(&(auxnameRows[2+ii][0]),"B%d",i); nameRows[2+ii]=&auxnameRows[2+ii][0];
8355  sprintf(&(auxnameRows[3+ii][0]),"C%d",i); nameRows[3+ii]=&auxnameRows[3+ii][0];
8356  sprintf(&(auxnameRows[4+ii][0]),"D%d",i); nameRows[4+ii]=&auxnameRows[4+ii][0];
8357  ii+=4;
8358 
8359  } else {
8360  typeRows[1+ii]=GLP_UP;typeRows[2+ii]=GLP_UP;typeRows[3+ii]=GLP_UP;typeRows[4+ii]=GLP_UP;
8361  typeRows[5+ii]=GLP_UP;typeRows[6+ii]=GLP_UP;typeRows[7+ii]=GLP_UP;typeRows[8+ii]=GLP_UP;
8362  typeRows[9+ii]=GLP_LO;
8363 
8364  sprintf(&(auxnameRows[1+ii][0]),"Ap%d",i); nameRows[1+ii]=&auxnameRows[1+ii][0];
8365  sprintf(&(auxnameRows[2+ii][0]),"Bp%d",i); nameRows[2+ii]=&auxnameRows[2+ii][0];
8366  sprintf(&(auxnameRows[3+ii][0]),"Cp%d",i); nameRows[3+ii]=&auxnameRows[3+ii][0];
8367  sprintf(&(auxnameRows[4+ii][0]),"Dp%d",i); nameRows[4+ii]=&auxnameRows[4+ii][0];
8368  sprintf(&(auxnameRows[5+ii][0]),"Am%d",i); nameRows[5+ii]=&auxnameRows[5+ii][0];
8369  sprintf(&(auxnameRows[6+ii][0]),"Bm%d",i); nameRows[6+ii]=&auxnameRows[6+ii][0];
8370  sprintf(&(auxnameRows[7+ii][0]),"Cm%d",i); nameRows[7+ii]=&auxnameRows[7+ii][0];
8371  sprintf(&(auxnameRows[8+ii][0]),"Dm%d",i); nameRows[8+ii]=&auxnameRows[8+ii][0];
8372  sprintf(&(auxnameRows[9+ii][0]),"LAMBDA%d",i); nameRows[9+ii]=&auxnameRows[9+ii][0];
8373  ii+=9;
8374  }
8375  }
8376 
8377 
8378 
8379 
8380 //----------------- write the COLUMNS section
8381 
8382 // fprintf(FMCS,"COLUMNS\n"); //--------stampaggi
8383 
8384 // Column variable m1
8385 
8386  ii=0;
8387  for(i=0 ; i< NpointsInFit ; i++) {
8388 
8389  if( mvdhit[i]){
8390 //---stampaggi
8391 // fprintf(FMCS," m1 A%d %g\n m1 B%d %g\n",i,Ox[i],i,-Ox[i]);
8392 //-----stampaggi, fine
8393 
8394  Coefficients[ii]= Ox[i];
8395  Coefficients[ii+1]= -Ox[i];
8396  ii +=2;
8397  } else {
8398 //---stampaggi
8399 // fprintf(FMCS," m1 Ap%d %g Am%d %g\n m1 Bp%d %g Bm%d %g\n",
8400 // i,Ox[i],i,Ox[i],i,-Ox[i],i,-Ox[i]);
8401 //-----stampaggi, fine
8402 
8403  Coefficients[ii]= Ox[i];
8404  Coefficients[ii+1]= Ox[i];
8405  Coefficients[ii+2]= -Ox[i];
8406  Coefficients[ii+3]= -Ox[i];
8407  ii += 4;
8408  }
8409  }
8410 
8411 
8412 
8413 // Column variable m2
8414  for(i=0, ii=0; i< NpointsInFit ; i++) {
8415  if( mvdhit[i]){
8416 // fprintf(FMCS," m2 A%d %g\n m2 B%d %g\n",//---stampaggi
8417 // i,-Ox[i],i,Ox[i]);//---stampaggi
8418  Coefficients[NStructRowsMax+ii]= -Ox[i];
8419  Coefficients[NStructRowsMax+ii+1]= Ox[i];
8420  ii += 2;
8421  } else {
8422 // fprintf(FMCS," m2 Ap%d %g Am%d %g\n m2 Bp%d %g Bm%d %g\n",//---stampaggi
8423 // i,-Ox[i],i,-Ox[i],i,Ox[i],i,Ox[i]);//---stampaggi
8424  Coefficients[NStructRowsMax+ii]= -Ox[i];
8425  Coefficients[NStructRowsMax+ii+1]= -Ox[i];
8426  Coefficients[NStructRowsMax+ii+2]= Ox[i];
8427  Coefficients[NStructRowsMax+ii+3]= Ox[i];
8428  ii += 4;
8429  }
8430  }
8431 
8432 // Column variable q1
8433  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
8434  if( mvdhit[i]){
8435 // fprintf(FMCS," q1 A%d 1.\n q1 B%d -1.\n",//---stampaggi
8436 // i,i);//---stampaggi
8437  Coefficients[2*NStructRowsMax+ii]= 1.;
8438  Coefficients[2*NStructRowsMax+ii+1]= -1.;
8439  ii +=2;
8440  } else {
8441 // fprintf(FMCS," q1 Ap%d 1. Am%d 1.\n q1 Bp%d -1. Bm%d -1.\n",//---stampaggi
8442 // i,i,i,i);//---stampaggi
8443  Coefficients[2*NStructRowsMax+ii]= 1.;
8444  Coefficients[2*NStructRowsMax+ii+1]= 1.;
8445  Coefficients[2*NStructRowsMax+ii+2]= -1.;
8446  Coefficients[2*NStructRowsMax+ii+3]= -1.;
8447  ii += 4;
8448  }
8449  }
8450 
8451 // Column variable q2
8452  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
8453  if( mvdhit[i]){
8454 // fprintf(FMCS," q2 A%d -1.\n q2 B%d 1.\n",//---stampaggi
8455 // i,i);//---stampaggi
8456  Coefficients[3*NStructRowsMax+ii]= -1.;
8457  Coefficients[3*NStructRowsMax+ii+1]= 1.;
8458  ii += 2;
8459  } else {
8460 // fprintf(FMCS," q2 Ap%d -1. Am%d -1.\n q2 Bp%d 1. Bm%d 1.\n",//---stampaggi
8461 // i,i,i,i);//---stampaggi
8462  Coefficients[3*NStructRowsMax+ii]= -1.;
8463  Coefficients[3*NStructRowsMax+ii+1]= -1.;
8464  Coefficients[3*NStructRowsMax+ii+2]= 1.;
8465  Coefficients[3*NStructRowsMax+ii+3]= 1.;
8466  ii += 4;
8467  }
8468 
8469  }
8470 
8471 // Column variable lambdap(i)
8472  for(i=0 ; i< NpointsInFit ; i++) {
8473  ii=(4+i)*NStructRowsMax;
8474  Coefficients[ii]= -M;
8475  Coefficients[ii+1]= -M;
8476  Coefficients[ii+2]= -M;
8477  Coefficients[ii+3]= M;
8478 /*
8479  if( mvdhit[i]){
8480  fprintf(FMCS," lam%d A%d %g B%d %g\n lam%d C%d %g D%d %g\n",//---stampaggi
8481  i,i,-M,i,-M, i , i,-M, i, M);//---stampaggi
8482  } else {
8483  fprintf(FMCS," lamp%d Ap%d %g Bp%d %g\n lamp%d Cp%d %g Dp%d %g\n lamp%d LAMBDA%d 1.\n",//---stampaggi
8484  i,i,-M,i,-M, i , i,-M, i, M, i,i);//---stampaggi
8485  }
8486 */
8487  if(! mvdhit[i]) Coefficients[ii+4]= 1.;
8488 
8489  }
8490 
8491 
8492 
8493 // Column variable lambdam(i)
8494  for(i=0 ; i< NpointsInFit ; i++) {
8495  if( mvdhit[i]) continue;
8496  ii+= NStructRowsMax;
8497 // fprintf(FMCS," lamm%d Am%d %g Bm%d %g\n lamm%d Cm%d %g Dm%d %g\n lamm%d LAMBDA%d 1.\n",//---stampaggi
8498 // i,i,-M,i,-M, i,i , -M, i, M, i,i);//---stampaggi
8499  Coefficients[ii]= -M;
8500  Coefficients[ii+1]= -M;
8501  Coefficients[ii+2]= -M;
8502  Coefficients[ii+3]= M;
8503  Coefficients[ii+4]= 1.;
8504  }
8505 // Column variable sigmap(i)
8506  for(i=0; i< NpointsInFit ; i++) {
8507  ii+= NStructRowsMax;
8508 
8509 /*
8510  if( mvdhit[i]){
8511  fprintf(FMCS," sigma%d OBJECT %g A%d -1.\n sigma%d B%d -1. C%d 1.\n sigma%d D%d -1.\n",//---stampaggi
8512  i,1./Delta[i],i,i,i,i,i,i);//---stampaggi
8513 
8514  } else {
8515  fprintf(FMCS," sigmap%d OBJECT %g Ap%d -1.\n sigmap%d Bp%d -1. Cp%d 1.\n sigmap%d Dp%d -1.\n",//---stampaggi
8516  i,1./Delta[i],i,i,i,i,i,i);//---stampaggi
8517  }
8518 */
8519 
8520 
8521  Coefficients[ii]= 1./Delta[i];
8522  Coefficients[ii+1]= -1.;
8523  Coefficients[ii+2]= -1.;
8524  Coefficients[ii+3]= 1.;
8525  Coefficients[ii+4]= -1.;
8526 
8527 
8528  }
8529 // Column variable sigmam(i)
8530  for(i=0 ; i< NpointsInFit ; i++) {
8531  if( mvdhit[i])continue;
8532  ii+= NStructRowsMax;
8533 /*
8534  fprintf(FMCS," sigmam%d OBJECT %g Am%d -1.\n sigmam%d Bm%d -1. Cm%d 1.\n sigmam%d Dm%d -1.\n",//---stampaggi
8535  i,1./Delta[i],i,i,i,i,i,i);//---stampaggi
8536 */
8537  Coefficients[ii]= 1./Delta[i];
8538  Coefficients[ii+1]= -1.;
8539  Coefficients[ii+2]= -1.;
8540  Coefficients[ii+3]= 1.;
8541  Coefficients[ii+4]= -1.;
8542  }
8543 
8544 // Column variable DUMMY
8545 //-----------stampaggi
8546 /*
8547  for(i=0 ; i< NpointsInFit ; i++) {
8548  if( mvdhit[i]){
8549  fprintf(FMCS," DUMMY A%d 1.\n DUMMY B%d 1.\n DUMMY C%d 1.\n",i,i,i);
8550  fprintf(FMCS," DUMMY D%d 1.\n",i);
8551  } else {
8552  fprintf(FMCS," DUMMY Ap%d 1. Am%d 1.\n DUMMY Bp%d 1. Bm%d 1.\n DUMMY Cp%d 1. Cm%d 1\n",
8553  i,i,i,i,i,i);
8554  fprintf(FMCS," DUMMY Dp%d 1. Dm%d 1.\n",i,i);
8555  }
8556  }
8557 */
8558 //---fine stampaggi
8559  ii+= NStructRowsMax;
8560  for(i=0, iii=0 ; i< NpointsInFit ; i++) {
8561  if( mvdhit[i]){
8562  Coefficients[ii+iii]= 1.;
8563  Coefficients[ii+iii+1]= 1.;
8564  Coefficients[ii+iii+2]= 1.;
8565  Coefficients[ii+iii+3]= 1.;
8566  iii +=4;
8567  } else {
8568  Coefficients[ii+iii]= 1.;
8569  Coefficients[ii+iii+1]= 1.;
8570  Coefficients[ii+iii+2]= 1.;
8571  Coefficients[ii+iii+3]= 1.;
8572  Coefficients[ii+iii+4]= 1.;
8573  Coefficients[ii+iii+5]= 1.;
8574  Coefficients[ii+iii+6]= 1.;
8575  Coefficients[ii+iii+7]= 1.;
8576  iii +=8;
8577  }
8578  }
8579 
8580 //-----------
8581 
8582 //--- give the names to the Structural Variables
8583 
8584  sprintf(&auxStructVarName[0][0],"m1",i);
8585  StructVarName[0] = &auxStructVarName[0][0];
8586  sprintf(&auxStructVarName[1][0],"m2",i);
8587  StructVarName[1] = &auxStructVarName[1][0];
8588 
8589  sprintf(&auxStructVarName[2][0],"q1",i);
8590  StructVarName[2] = &auxStructVarName[2][0];
8591 
8592  sprintf(&auxStructVarName[3][0],"q2",i);
8593  StructVarName[3] = &auxStructVarName[3][0];
8594  for(i=0, ii=0; i< NpointsInFit ; i++) {
8595  if( mvdhit[i]){
8596  sprintf(&auxStructVarName[4+i][0],"lam%d",i);
8597  StructVarName[4+i] = &auxStructVarName[4+i][0];
8598 
8599  sprintf(&auxStructVarName[4+nMvdHits+2*nSttHits+i][0],"sigma%d",i);
8600  StructVarName[4+nMvdHits+2*nSttHits+i] = &auxStructVarName[4+nMvdHits+2*nSttHits+i][0];
8601  } else {
8602  sprintf(&auxStructVarName[4+i][0],"lamp%d",i);
8603  StructVarName[4+i] = &auxStructVarName[4+i][0];
8604 
8605  sprintf(&auxStructVarName[4+NpointsInFit+ii][0],"lamm%d",i);
8606  StructVarName[4+NpointsInFit+ii] = &auxStructVarName[4+NpointsInFit+ii][0];
8607 
8608  sprintf(&auxStructVarName[4+nMvdHits+2*nSttHits+i][0],"sigmap%d",i);
8609  StructVarName[4+nMvdHits+2*nSttHits+i] = &auxStructVarName[4+nMvdHits+2*nSttHits+i][0];
8610 
8611  sprintf(&auxStructVarName[4+NpointsInFit+nMvdHits+2*nSttHits+ii][0],"sigmam%d",i);
8612  StructVarName[4+NpointsInFit+nMvdHits+2*nSttHits+ii] =
8613  &auxStructVarName[4+NpointsInFit+nMvdHits+2*nSttHits+ii][0];
8614  ii++;
8615  }
8616  }
8617 
8618 
8619  sprintf(&auxStructVarName[NStructVar-1][0],"DUMMY",i);
8620  StructVarName[NStructVar-1] = &auxStructVarName[NStructVar-1][0];
8621 
8622 
8623 
8624 //--- give the names of those Rows in which the Structural Variables are present
8625 
8626 // for m1, m2, q1, q2
8627  for(i=0; i< 4; i++){
8628  for(j=0, ii=0; j< NpointsInFit;j++){
8629  if( mvdhit[j]){
8630  sprintf(&aux[i*NStructRowsMax+ii][0],"A%d",j);
8631  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii]=&aux[i*NStructRowsMax+ii][0];
8632  sprintf(&aux[i*NStructRowsMax+ii+1][0],"B%d",j);
8633  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+1]=&aux[i*NStructRowsMax+ii+1][0];
8634  ii += 2;
8635  } else {
8636  sprintf(&aux[i*NStructRowsMax+ii][0],"Ap%d",j);
8637  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii]=&aux[i*NStructRowsMax+ii][0];
8638  sprintf(&aux[i*NStructRowsMax+ii+1][0],"Am%d",j);
8639  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+1]=&aux[i*NStructRowsMax+ii+1][0];
8640  sprintf(&aux[i*NStructRowsMax+ii+2][0],"Bp%d",j);
8641  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+2]=&aux[i*NStructRowsMax+ii+2][0];
8642  sprintf(&aux[i*NStructRowsMax+ii+3][0],"Bm%d",j);
8643  NameRowsInWhichStructVarArePresent[i*NStructRowsMax+ii+3]=&aux[i*NStructRowsMax+ii+3][0];
8644  ii += 4;
8645  }
8646  }
8647  }
8648 
8649 // now for the lamp* variables
8650  for(i=0; i< NpointsInFit;i++){
8651  if( mvdhit[i]){
8652  sprintf(&aux[(i+4)*NStructRowsMax+0][0],"A%d",i);
8653  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+0]= &aux[(i+4)*NStructRowsMax+0][0];
8654  sprintf(&aux[(i+4)*NStructRowsMax+1][0],"B%d",i);
8655  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+1]= &aux[(i+4)*NStructRowsMax+1][0];
8656  sprintf(&aux[(i+4)*NStructRowsMax+2][0],"C%d",i);
8657  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+2]= &aux[(i+4)*NStructRowsMax+2][0];
8658  sprintf(&aux[(i+4)*NStructRowsMax+3][0],"D%d",i);
8659  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+3]= &aux[(i+4)*NStructRowsMax+3][0];
8660  } else {
8661  sprintf(&aux[(i+4)*NStructRowsMax+0][0],"Ap%d",i);
8662  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+0]= &aux[(i+4)*NStructRowsMax+0][0];
8663  sprintf(&aux[(i+4)*NStructRowsMax+1][0],"Bp%d",i);
8664  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+1]= &aux[(i+4)*NStructRowsMax+1][0];
8665  sprintf(&aux[(i+4)*NStructRowsMax+2][0],"Cp%d",i);
8666  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+2]= &aux[(i+4)*NStructRowsMax+2][0];
8667  sprintf(&aux[(i+4)*NStructRowsMax+3][0],"Dp%d",i);
8668  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+3]= &aux[(i+4)*NStructRowsMax+3][0];
8669  sprintf(&aux[(i+4)*NStructRowsMax+4][0],"LAMBDA%d",i);
8670  NameRowsInWhichStructVarArePresent[(i+4)*NStructRowsMax+4]= &aux[(i+4)*NStructRowsMax+4][0];
8671  }
8672  }
8673 
8674 // now for the lamm* variables
8675  for(i=0, ii=0; i< NpointsInFit;i++){
8676  if( mvdhit[i]) continue;
8677  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax][0],"Am%d",i);
8678  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax]= &aux[(ii+4+NpointsInFit)*NStructRowsMax][0];
8679  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+1][0],"Bm%d",i);
8680  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+1]= &aux[(ii+4+NpointsInFit)*NStructRowsMax+1][0];
8681  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+2][0],"Cm%d",i);
8682  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+2]= &aux[(ii+4+NpointsInFit)*NStructRowsMax+2][0];
8683  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+3][0],"Dm%d",i);
8684  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+3]= &aux[(ii+4+NpointsInFit)*NStructRowsMax+3][0];
8685  sprintf(&aux[(ii+4+NpointsInFit)*NStructRowsMax+4][0],"LAMBDA%d",i);
8686  NameRowsInWhichStructVarArePresent[(ii+4+NpointsInFit)*NStructRowsMax+4]= &aux[(ii+4+NpointsInFit)*NStructRowsMax+4][0];
8687  ii++;
8688  }
8689 
8690 // now for the sigmap* variables
8691  for(i=0; i< NpointsInFit;i++){
8692  if( mvdhit[i]) {
8693 // sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT",i);
8694  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT");
8695  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax]=
8696  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0];
8697  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0],"A%d",i);
8698  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1]=
8699  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0];
8700  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0],"B%d",i);
8701  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2]=
8702  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0];
8703  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0],"C%d",i);
8704  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3]=
8705  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0];
8706  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0],"D%d",i);
8707  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4]=
8708  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0];
8709  } else {
8710 // sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT",i);
8711  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT");
8712  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax]=
8713  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax][0];
8714  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0],"Ap%d",i);
8715  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1]=
8716  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+1][0];
8717  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0],"Bp%d",i);
8718  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2]=
8719  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+2][0];
8720  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0],"Cp%d",i);
8721  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3]=
8722  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+3][0];
8723  sprintf(&aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0],"Dp%d",i);
8724  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4]=
8725  &aux[(i+4+NpointsInFit+nSttHits)*NStructRowsMax+4][0];
8726  }
8727  }
8728 
8729 // now for the sigmam* variables
8730  for(i=0, ii=0; i< NpointsInFit;i++){
8731  if( mvdhit[i]) continue;
8732  // sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT",i);
8733  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax][0],"OBJECT");
8734  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax]=
8735  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax][0];
8736 
8737  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+1][0],"Am%d",i);
8738  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+1]=
8739  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+1][0];
8740 
8741  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+2][0],"Bm%d",i);
8742  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+2]=
8743  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+2][0];
8744 
8745  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+3][0],"Cm%d",i);
8746  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+3]=
8747  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+3][0];
8748 
8749  sprintf(&aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+4][0],"Dm%d",i);
8750  NameRowsInWhichStructVarArePresent[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+4]=
8751  &aux[(ii+4+2*NpointsInFit+nSttHits)*NStructRowsMax+4][0];
8752  ii++;
8753  }
8754 
8755 // now for the DUMMY variable
8756  for(i=0, ii=0; i< NpointsInFit;i++){
8757  if( mvdhit[i]) {
8758  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii][0],"A%d",i);
8759  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii]=
8760  &aux[(NStructVar-1)*NStructRowsMax+ii][0];
8761 
8762  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+1][0],"B%d",i);
8763  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+1]=
8764  &aux[(NStructVar-1)*NStructRowsMax+ii+1][0];
8765 
8766  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+2][0],"C%d",i);
8767  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+2]=
8768  &aux[(NStructVar-1)*NStructRowsMax+ii+2][0];
8769 
8770  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+3][0],"D%d",i);
8771  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+3]=
8772  &aux[(NStructVar-1)*NStructRowsMax+ii+3][0];
8773  ii += 4;
8774  } else {
8775  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii][0],"Ap%d",i);
8776  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii]=
8777  &aux[(NStructVar-1)*NStructRowsMax+ii][0];
8778 
8779  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+1][0],"Am%d",i);
8780  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+1]=
8781  &aux[(NStructVar-1)*NStructRowsMax+ii+1][0];
8782 
8783  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+2][0],"Bp%d",i);
8784  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+2]=
8785  &aux[(NStructVar-1)*NStructRowsMax+ii+2][0];
8786 
8787  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+3][0],"Bm%d",i);
8788  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+3]=
8789  &aux[(NStructVar-1)*NStructRowsMax+ii+3][0];
8790  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+4][0],"Cp%d",i);
8791  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+4]=
8792  &aux[(NStructVar-1)*NStructRowsMax+ii+4][0];
8793 
8794  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+5][0],"Cm%d",i);
8795  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+5]=
8796  &aux[(NStructVar-1)*NStructRowsMax+ii+5][0];
8797 
8798  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+6][0],"Dp%d",i);
8799  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+6]=
8800  &aux[(NStructVar-1)*NStructRowsMax+ii+6][0];
8801 
8802  sprintf(&aux[(NStructVar-1)*NStructRowsMax+ii+7][0],"Dm%d",i);
8803  NameRowsInWhichStructVarArePresent[(NStructVar-1)*NStructRowsMax+ii+7]=
8804  &aux[(NStructVar-1)*NStructRowsMax+ii+7][0];
8805  ii += 8;
8806  }
8807  }
8808 
8809 
8810 
8811 //----------------- write the RHS section
8812 
8813 // fprintf(FMCS,"RHS\n");//---stampaggi
8814  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
8815  if( mvdhit[i]){
8816 //---stampaggi
8817 /*
8818  fprintf(FMCS," BOUND A%d %g B%d %g\n BOUND C%d %g D%d %g\n",
8819  i, Oy[i]+2.*M,i,
8820  -Oy[i]+2.*M,i,
8821  Delta[i]+2.*M,i,M-Delta[i]+2.*M);
8822 */
8823 //---fine stampaggi
8824  ValueB[ii] = Oy[i]+2.*M;
8825  ValueB[ii+1]= -Oy[i]+2.*M;
8826  ValueB[ii+2]= Delta[i]+2.*M;
8827  ValueB[ii+3]= M-Delta[i]+2.*M;
8828  ii += 4;
8829  } else {
8830 //---stampaggi
8831 /*
8832  fprintf(FMCS," BOUND Ap%d %g Bp%d %g\n BOUND Cp%d %g Dp%d %g\n",
8833  i, Oy[i]+DriftRadius[ i ]+2.*M,i,
8834  -Oy[i]-DriftRadius[ i ]+2.*M,i,
8835  Delta[i]+2.*M,i,M-Delta[i]+2.*M);
8836 */
8837 //---fine stampaggi
8838  ValueB[ii] = Oy[i]+DriftRadius[ i ]+2.*M;
8839  ValueB[ii+1]= -Oy[i]-DriftRadius[ i ]+2.*M;
8840  ValueB[ii+2]= Delta[i]+2.*M;
8841  ValueB[ii+3]= M-Delta[i]+2.*M;
8842 
8843 
8844 //---stampaggi
8845 /*
8846  fprintf(FMCS," BOUND Am%d %g Bm%d %g\n BOUND Cm%d %g Dm%d %g\n",
8847  i, Oy[i]-DriftRadius[ i ]+2.*M,i,
8848  -Oy[i]+DriftRadius[ i ]+2.*M,i,
8849  Delta[i]+2.*M,i,M-Delta[i]+2.*M);f
8850  fprintf(FMCS," BOUND LAMBDA%d 1.\n",i);
8851 */
8852 //---fine stampaggi
8853  ValueB[ii+4]= Oy[i]-DriftRadius[ i ]+2.*M;
8854  ValueB[ii+5]= -Oy[i]+DriftRadius[ i ]+2.*M;
8855  ValueB[ii+6]= Delta[i]+2.*M;
8856  ValueB[ii+7]= M-Delta[i]+2.*M;
8857  ValueB[ii+8]= 1.;
8858  ii +=9;
8859  }
8860 
8861  }
8862 
8863 
8864 //----------------- write the RANGES section
8865 
8866 // fprintf(FMCS,"RANGES\n");//---stampaggi
8867  for(i=0 , ii=0; i< NpointsInFit ; i++) {
8868  if( mvdhit[i]) continue;
8869 // fprintf(FMCS," RANGE LAMBDA%d 1.\n",i);//---stampaggi
8870 //---
8871  ValueRanges[ii]=1.;
8872  sprintf(&auxNameRanges[ii][0],"LAMBDA%d",i);
8873  NameRanges[ii]=&auxNameRanges[ii][0];
8874  ii++;
8875  }
8876 
8877 //----------------- write the BOUNDS section
8878 // fprintf(FMCS,"BOUNDS\n");//---stampaggi
8879 
8880 
8881  for(i=0 ; i< NpointsInFit ; i++) {
8882  if( mvdhit[i]){
8883 // fprintf(FMCS," BV Bounds lam%d\n", i);//---stampaggi
8884  sprintf(&auxTypeofBound[i][0],"BV"); TypeofBound[i]= &auxTypeofBound[i][0];
8885  sprintf(&auxBoundStructVarName[i][0],"lam%d",i);
8886  } else {
8887 // fprintf(FMCS," BV Bounds lamp%d\n", i);//---stampaggi
8888  sprintf(&auxTypeofBound[i][0],"BV"); TypeofBound[i]= &auxTypeofBound[i][0];
8889  sprintf(&auxBoundStructVarName[i][0],"lamp%d",i);
8890  }
8891 
8892  BoundStructVarName[i]=&auxBoundStructVarName[i][0];
8893  BoundValue[i]=0.;
8894 
8895  }
8896 
8897  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
8898  if( mvdhit[i]) continue;
8899 // fprintf(FMCS," BV Bounds lamm%d\n", i);//---stampaggi
8900  sprintf(&auxTypeofBound[ii+NpointsInFit][0],"BV");
8901  TypeofBound[ii+NpointsInFit]= &auxTypeofBound[ii+NpointsInFit][0];
8902  sprintf(&auxBoundStructVarName[ii+NpointsInFit][0],"lamm%d",i);
8903  BoundStructVarName[ii+NpointsInFit]=&auxBoundStructVarName[ii+NpointsInFit][0];
8904  BoundValue[ii+NpointsInFit]=0.;
8905  ii++;
8906  }
8907 
8908 // fprintf(FMCS," FX Bounds DUMMY %g\n",2.*M);//--stampaggi
8909  sprintf(&auxTypeofBound[NpointsInFit+nSttHits][0],"FX");
8910  TypeofBound[NpointsInFit+nSttHits]= &auxTypeofBound[NpointsInFit+nSttHits][0];
8911 
8912  sprintf(&auxTypeofBound[NpointsInFit+nSttHits][0],"FX");
8913  TypeofBound[NpointsInFit+nSttHits]= &auxTypeofBound[NpointsInFit+nSttHits][0];
8914 
8915  sprintf(&auxBoundStructVarName[NpointsInFit+nSttHits][0],"DUMMY");
8916  BoundStructVarName[NpointsInFit+nSttHits]=&auxBoundStructVarName[NpointsInFit+nSttHits][0];
8917  BoundValue[NpointsInFit+nSttHits]=2.*M;
8918 
8919 // fixing q1
8920 // fprintf(FMCS," FX Bounds q1 %g\n",0.);//--stampaggi
8921  sprintf(&auxTypeofBound[NpointsInFit+nSttHits+1][0],"FX");
8922  TypeofBound[NpointsInFit+nSttHits+1]=&auxTypeofBound[NpointsInFit+nSttHits+1][0];
8923  sprintf(&auxBoundStructVarName[NpointsInFit+nSttHits+1][0],"q1");
8924  BoundStructVarName[NpointsInFit+nSttHits+1]=&auxBoundStructVarName[NpointsInFit+nSttHits+1][0];
8925  BoundValue[NpointsInFit+nSttHits+1]= 0.;
8926 // fixing q2
8927 // fprintf(FMCS," FX Bounds q2 %g\n",0.);//--stampaggi
8928  sprintf(&auxTypeofBound[NpointsInFit+nSttHits+2][0],"FX");
8929  TypeofBound[NpointsInFit+nSttHits+2]=&auxTypeofBound[NpointsInFit+nSttHits+2][0];
8930  sprintf(&auxBoundStructVarName[NpointsInFit+nSttHits+2][0],"q2");
8931  BoundStructVarName[NpointsInFit+nSttHits+2]=&auxBoundStructVarName[NpointsInFit+nSttHits+2][0];
8932  BoundValue[NpointsInFit+nSttHits+2]= 0.;
8933 
8934 //-----
8935 
8936 //------------------------------------------------------------stampaggi
8937 /*
8938  fprintf(FMCS,"ENDATA\n");
8939  fclose(FMCS);
8940 */
8941 
8942 /*
8943 cout<<"n. punti nel fit "<<NpointsInFit<<endl;
8944 
8945 
8946 cout<<"nRows "<<nRows<<endl;
8947 for(int ic =0;ic<nRows; ic++){
8948  cout<<"n. Row "<<ic<<", nameRows "<<nameRows[ic]<<", typeRows "<<typeRows[ic]<<endl;
8949 }
8950 
8951 cout<<"NStructRowsMax = "<<NStructRowsMax<<endl;
8952 cout<<"NStructVar "<<NStructVar<<" e loro elenco "<<endl;
8953 for(int ic =0;ic<NStructVar; ic++){
8954  cout<<"\tvar. n. "<<ic<<", nome = "<<StructVarName[ic]<<endl;
8955 }
8956 
8957 
8958 
8959 for(int ic =0;ic<NStructVar; ic++){
8960  cout<<"NRowsInWhichStructVarArePresent "<<NRowsInWhichStructVarArePresent[ic]
8961  <<", nome var. strut. n."<<ic<<" = "
8962  <<StructVarName[ic]<<endl;
8963 
8964  for(int jc=0; jc<NRowsInWhichStructVarArePresent[ic];jc++){
8965  cout<<"n. "<<jc<<" NameRowsInWhichStructVarArePresent "<<NameRowsInWhichStructVarArePresent[ic*NStructRowsMax+jc]<<endl;
8966  }
8967 }
8968 
8969 
8970 cout<<"n Coefficient "<<21*nMvdHits+24*nSttHits<<endl;
8971 iii=0;
8972 for(int ic =0;ic<NStructVar; ic++){
8973  cout<<"Struct. Var."<< StructVarName[ic] <<" e' presente in "<< NRowsInWhichStructVarArePresent[ic]
8974  <<" Rows;"<<endl;
8975  for(ii=0;ii<NRowsInWhichStructVarArePresent[ic];ii++){
8976 
8977  cout<<"\tin Row "<<NameRowsInWhichStructVarArePresent[ic*NStructRowsMax+ii]
8978  <<", ha Coefficient "<<Coefficients[ic*NStructRowsMax+ii]<<
8979  " (n. sequenziale = "<<iii<<")"<<endl;
8980  iii++;
8981  }
8982 }
8983 
8984 cout<<"n valuesB "<<nRows-1<<endl;
8985 for(int ic =0;ic<nRows-1; ic++){
8986  cout<<"n. "<<ic<<", valuesB "<<ValueB[ic]<<endl;
8987 }
8988 cout<<"n ranges "<<nRanges<<endl;
8989 for(int ic =0;ic<nRanges; ic++){
8990  cout<<"n. "<<ic<<", RANGES "<<ValueRanges[ic]<<endl;
8991 }
8992 cout<<"n Bounds "<<nBounds<<endl;
8993 for(int ic =0;ic<nBounds; ic++){
8994  cout<<"n. "<<ic<<", Bounds "<<BoundValue[ic]<<endl;
8995  cout<<"n. "<<ic<<", Bound Type "<<TypeofBound[ic]<<endl;
8996  cout<<"n. "<<ic<<", Bound Name "<<BoundStructVarName[ic]<<endl;
8997 }
8998 */
8999 
9000 //-------fine stampaggi
9001 
9002 //----------------------- funzioni chiamate direttamente
9003 /*
9004 cout<<"cavolo2, da sttmvdtracking : nRows = "<<nRows<<", NStructVar = "<<
9005  NStructVar<<", NStructRowsMax = "<<NStructRowsMax<<
9006  ", NRowsInWhichStructVarArePresent = "<<
9007  NRowsInWhichStructVarArePresent<<", nRanges = "<<nRanges
9008  <<", nBounds = "<<nBounds<<endl;
9009 */
9010  int status= glp_main(
9011  nRows,nameRows,typeRows, // ROWS info
9012  NStructVar, NStructRowsMax, NRowsInWhichStructVarArePresent, // COLUMNS info
9013  StructVarName, NameRowsInWhichStructVarArePresent, // COLUMNS info
9014  Coefficients, // COLUMNS info
9015  ValueB, // RHS info
9016  nRanges, ValueRanges, NameRanges, // RANGES info
9017  nBounds, BoundValue, BoundStructVarName, TypeofBound // BOUNDS info
9018 // ,final_values, TIMEOUT
9019  ,final_values
9020  );
9021 
9022  if (status != 0) return -5; // fit failed
9023 
9024 //--------stampaggi
9025 if(istampa>=3){
9026 printf("from PndSttTrackFinderReal:FitSZ, final printout dopo glpmain -------------------------------\n");
9027 printf(" number of structural variables %d\n",NStructVar);
9028 int ica;
9029 for(ica=0;ica<NStructVar;ica++){
9030  printf("name of structural variable %s and its final value %g\n",
9031  StructVarName[ica], final_values[ica]);
9032 }
9033 printf("from main, end of final printout con routines chiamate direttamente -------------------------------\n");
9034 }
9035 //--------fine stampaggi
9036 
9037 
9038 
9039 //----------------------- fine funzioni chiamate direttamente
9040 
9041 
9042  m1_result=final_values[0];
9043  m2_result=final_values[1];
9044 // q1_result=final_values[2];
9045 // q2_result=final_values[3];
9046 
9047 
9048  *emme = m1_result-m2_result ;
9049 // taking into account the rotation + traslation that was performed and calculate emme and qu
9050 
9051  if(fabs(cose-*emme*sine)> 1.e-10) {
9052  *emme=((*emme)*cose+sine)/(cose-(*emme)*sine);
9053  return 1;
9054  } else { // in this case the equation is 0 = U in the Conformal plane --> x=0 in the XY plane.
9055  return -99;
9056  }
9057 
9058 
9059 
9060 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
Int_t i
Definition: run_full.C:25
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
int n
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Double_t PI
double Z
Definition: anaLmdDigi.C:68
Double_t angle
int status[10]
Definition: f_Init.h:28
void PndSttTrackFinderReal::FixDiscontinuitiesFiangleinSZplane ( Short_t  TemporarynSttSkewhitinTrack,
Double_t S,
Double_t Fi_initial_helix_referenceframe,
Short_t  Charge 
)
private

Definition at line 11144 of file PndSttTrackFinderReal.cxx.

References Double_t, i, max(), min(), and PI.

Referenced by DoFind().

11150 {
11151 
11152  Short_t i;
11153  Double_t max, min;
11154 
11155  for(i=0, min = 9999., max = -9999.; i<TemporarynSttSkewhitinTrack; i++){
11156  if( S[i] > max ) max = S[i];
11157  if( S[i] < min ) min = S[i];
11158  }
11159 
11160 
11161  if( max-min> PI) {
11162  for(i=0, min = 9999., max = -9999.; i<TemporarynSttSkewhitinTrack; i++){
11163  if( S[i] < PI ) S[i] += 2.*PI;
11164  if( S[i] > max ) max = S[i];
11165  if( S[i] < min ) min = S[i];
11166  }
11167 
11168  }
11169 
11170 
11171  if( Charge >0 ){
11172  if( *Fi_initial_helix_referenceframe < max ) *Fi_initial_helix_referenceframe += 2.*PI;
11173  } else {
11174  if( *Fi_initial_helix_referenceframe > min ) *Fi_initial_helix_referenceframe -= 2.*PI;
11175  }
11176 
11177  return;
11178 
11179 }
Int_t i
Definition: run_full.C:25
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
Double_t
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:25
static const Double_t PI
PndSttHit * PndSttTrackFinderReal::GetHitFromCollections ( Int_t  hitCounter)
private

Definition at line 378 of file PndSttTrackFinderReal.cxx.

References At, fHitCollectionList, and GetEntriesFast().

Referenced by DoFind().

379 {
380  PndSttHit
381  *retval = NULL;
382 
383  Int_t
384  relativeCounter = hitCounter;
385 
386  for (Int_t collectionCounter = 0; collectionCounter < fHitCollectionList.GetEntries(); collectionCounter++)
387  {
388  Int_t
389  size = ((TClonesArray *)fHitCollectionList.At(collectionCounter))->GetEntriesFast();
390 
391  if (relativeCounter < size)
392  {
393  retval = (PndSttHit*) ((TClonesArray *)fHitCollectionList.At(collectionCounter))->At(relativeCounter);
394  break;
395  }
396  else
397  {
398  relativeCounter -= size;
399  }
400  }
401  return retval;
402 }
cout<< "POINTs for new FwEndCap == "<< tsim-> GetEntriesFast()
cout<<"the Event No is "<< i<< endl;{{if(hit_array->GetEntriesFast()!=mc_array->GetEntriesFast()) continue;PndSdsHit *hit=(PndSdsHit *) hit_array-> At(j)
Definition: anaLmdCluster.C:71
FairMCPoint * PndSttTrackFinderReal::GetPointFromCollections ( Int_t  hitCounter)
private

Definition at line 410 of file PndSttTrackFinderReal.cxx.

References At, fHitCollectionList, fPointCollectionList, and GetEntriesFast().

Referenced by DoFind().

411 {
412  FairMCPoint
413  *retval = NULL;
414 
415  Int_t
416  relativeCounter = hitCounter;
417 
418  for (Int_t collectionCounter = 0; collectionCounter < fHitCollectionList.GetEntries(); collectionCounter++)
419  {
420  Int_t
421  size = ((TClonesArray *)fHitCollectionList.At(collectionCounter))->GetEntriesFast();
422 
423  if (relativeCounter < size)
424  {
425  Int_t
426  tmpHit = ((PndSttHit*) ((TClonesArray *)fHitCollectionList.At(collectionCounter))->At(relativeCounter))->GetRefIndex();
427 
428  retval = (FairMCPoint*) ((TClonesArray *)fPointCollectionList.At(collectionCounter))->At(tmpHit);
429 
430  break;
431  }
432  else
433  {
434  relativeCounter -= size;
435  }
436  }
437  return retval;
438 }
cout<< "POINTs for new FwEndCap == "<< tsim-> GetEntriesFast()
cout<<"the Event No is "<< i<< endl;{{if(hit_array->GetEntriesFast()!=mc_array->GetEntriesFast()) continue;PndSdsHit *hit=(PndSdsHit *) hit_array-> At(j)
Definition: anaLmdCluster.C:71
void PndSttTrackFinderReal::Init ( )
virtual

Initialisation

Reimplemented from PndSttTrackFinder.

Definition at line 275 of file PndSttTrackFinderReal.cxx.

References Double_t, PndSttTrackFinder::fHelixHitProduction, fMCTrackArray, fSciTHitArray, HANDLE, HANDLE2, HANDLEXYZ, hdist, hdistbadlast, hdistgoodlast, i, iplotta, istampa, MINIMUMHITSPERTRACK, nRdivConformal, nRdivConformalEffective, PHANDLEX, PHANDLEY, PHANDLEZ, r1, r2, radiaConf, RStrawDetectorMax, RStrawDetectorMin, SHANDLEX, SHANDLEY, SHANDLEZ, and YesSciTil.

276 {
277 
278  Short_t i;
279  Double_t r1, r2, A ,
280  tempRadiaConf[nRdivConformal];
281 
282 
284 
285 // --------------------------- opening files for special purposes
286 
287 if(istampa >=1 ){
288 //---- apertura file con info su Found tracce su cui si fa Helix fit dopo
289  HANDLE2 = fopen("info_da_PndTrackFinderReal.txt","w");
290 
291 // ---- open filehandle per statistica sugli hits etc.
292  HANDLE = fopen("statistichePndTrackFinderReal.txt","w");
293 // ---------------
294 if(istampa >=3 ) HANDLEXYZ = fopen("infoPndTrackFinderRealXYZ.txt","w");
295 
296 // --------------- open file delle info su deltaX, Y, Z degli hits in comune tra tracce trovate e MC
297 
298  PHANDLEX = fopen("deltaParXmio.txt","w");
299  PHANDLEY = fopen("deltaParYmio.txt","w");
300  PHANDLEZ = fopen("deltaParZmio.txt","w");
301  SHANDLEX = fopen("deltaSkewXmio.txt","w");
302  SHANDLEY = fopen("deltaSkewYmio.txt","w");
303  SHANDLEZ = fopen("deltaSkewZmio.txt","w");
304 
305 } // end of if(istampa >=1)
306 
307 
308 // -------------------------
309 
310 
311 
312  fHelixHitProduction = true;
313 
314 // IVOLTE=-1;
315 
316 
317  // Get and check FairRootManager
318  FairRootManager* ioman = FairRootManager::Instance();
319  if (!ioman)
320  {
321  cout << "-E- PndSttTrackFinderReal::Init: "
322  << "RootManager not instantiated, return!" << endl;
323  return;
324  }
325 
326 // get the MCTrack array
327 
328  fMCTrackArray = (TClonesArray*) ioman->GetObject("MCTrack");
329 
330 // get the SciTil point array
331 // fSciTPointArray = (TClonesArray*) ioman->GetObject("SciTPoint");
332 
333 
334 // get the SciTil hit array
335  if(YesSciTil) {
336  fSciTHitArray = (TClonesArray*) ioman->GetObject("SciTHit");
337  } else {
338  fSciTHitArray = NULL;
339  }
340 
341 
342 
343 
344 // -------------------------------------------------------------------
345 
346 
347  if(iplotta){
348  hdist = new TH1F("hdist", "distance (cm)", 20, 0., 10.);
349  hdistgoodlast = new TH1F("hDistanceTrulyInnerLast", "distance (cm)", 20, 0., 10.);
350  hdistbadlast = new TH1F("hDistanceNonLastInner", "distance (cm)", 20, 0., 10.);
351  }
352 
353 // calculate the boundaries of the Box in Conformal Space, see Gianluigi logbook on pag. 210-211
354 
355 
356  radiaConf[0] = 1./RStrawDetectorMax;
357  r1 = RStrawDetectorMin;
359  if ( nRdivConformal > 1 ) {
360  for(i = 1; i< nRdivConformal ; i++){
361  r2 = r1 + A;
362 // tempRadiaConf[nRdivConformal-i] = 1./r2;
363  radiaConf[nRdivConformal-i] = 1./r2;
364  r1=r2;
365 
366  }
367  }
368 
370 
371 //-------------------- end of method Init --------------------------------------------
372 
373 
374 
375 }
Int_t i
Definition: run_full.C:25
static const Double_t RStrawDetectorMin
double r1
Double_t
Double_t radiaConf[nRdivConformal]
static const Double_t RStrawDetectorMax
double r2
static const Short_t nRdivConformal
void PndSttTrackFinderReal::Initialization_ClassVariables ( )
private

Definition at line 154 of file PndSttTrackFinderReal.cxx.

References ALFA, BETA, CxMC, CyMC, FI0max, FI0min, Fimax, fMCTrackArray, fSciTHitArray, fSciTPointArray, fSttHitArray, GAMMA, HANDLE, HANDLE2, HANDLEXYZ, hdist, hdistbadlast, hdistgoodlast, InclusionListSciTil, infoparal, infoskew, IVOLTE, ListSciTilHitsinTrack, nHitsInMCTrack, nMCTracks, nRdivConformalEffective, nSciTilHits, nSciTilHitsinTrack, nSttSkewhit, nSttSkewhitInMCTrack, PHANDLEX, PHANDLEY, PHANDLEZ, pMCtr, posizSciTil, R_MC, radiaConf, S_SciTilHitsinTrack, SEMILENGTH_STRAIGHT, SHANDLEX, SHANDLEY, SHANDLEZ, stepD, stepFi, stepFI0, stepfineFI0, stepfineKAPPA, stepKAPPA, stepR, TypeConf, veritaMC, and ZCENTER_STRAIGHT.

Referenced by PndSttTrackFinderReal().

155 {
156 
157  // this is only for initializing the Class Variables.
158  char zero;
159  size_t len;
160 // booleans :
161  len = sizeof(InclusionListSciTil);
162  memset (InclusionListSciTil,0,len);
163  len = sizeof(TypeConf);
164  memset (TypeConf,0,len);
165 // int :
166  IVOLTE=-1;
167 
168 // Short_t :
169 
171  nSciTilHits=0;
172  nSttSkewhit=0;
173  nMCTracks=0;
174  len = sizeof(infoparal);
175  memset(infoparal,0,len);
176  len = sizeof(infoskew);
177  memset(infoskew,0,len);
178  len = sizeof(nHitsInMCTrack);
179  memset(nHitsInMCTrack,0,len);
180  len = sizeof(nSciTilHitsinTrack);
181  memset(nSciTilHitsinTrack,0,len);
182  len = sizeof(nSttSkewhitInMCTrack);
183  memset(nSttSkewhitInMCTrack,0,len);
184  len = sizeof(ListSciTilHitsinTrack);
185  memset(ListSciTilHitsinTrack,0,len);
186 // Double_t :
187  Fimax=0.;
188  FI0min=0.;
189  FI0max=0.;
190  stepD=0.;
191  stepFi=0.;
192  stepR=0.;
193  stepKAPPA=0.;
194  stepFI0=0.;
195  stepfineKAPPA=0.;
196  stepfineFI0=0.;
198  ZCENTER_STRAIGHT=0.;
199  len = sizeof(veritaMC);
200  memset (veritaMC,0,len);
201 
202  len = sizeof(ALFA);
203  memset (ALFA,0,len);
204  len = sizeof(BETA);
205  memset (BETA,0,len);
206  len = sizeof(GAMMA);
207  memset (GAMMA,0,len);
208  len = sizeof(radiaConf);
209  memset (radiaConf,0,len);
210  len = sizeof(CxMC);
211  memset (CxMC,0,len);
212  len = sizeof(CyMC);
213  memset (CyMC,0,len);
214  len = sizeof(R_MC);
215  memset (R_MC,0,len);
216  len = sizeof(posizSciTil);
217  memset (posizSciTil,0,len);
218  len = sizeof(S_SciTilHitsinTrack);
219  memset (S_SciTilHitsinTrack,0,len);
220 
221 // pointers :
222 
223  hdist=NULL;
224  hdistgoodlast=NULL,
225  hdistbadlast=NULL;
226  HANDLE=NULL;
227  HANDLE2=NULL;
228  HANDLEXYZ=NULL;
229  PHANDLEX=NULL;
230  PHANDLEY=NULL;
231  PHANDLEZ=NULL;
232  SHANDLEX=NULL;
233  SHANDLEY=NULL;
234  SHANDLEZ=NULL;
235 
236 
237  fMCTrackArray=NULL;
238  fSciTPointArray=NULL;
239  fSciTHitArray=NULL;
240 
241  pMCtr=NULL;
242 
243  fSttHitArray=NULL;
244 
245 
246  }
Double_t R_MC[MAXTRACKSPEREVENT]
Double_t posizSciTil[nmaxSciTilHits][3]
Double_t CxMC[MAXTRACKSPEREVENT]
Double_t GAMMA[MAXTRACKSPEREVENT]
Short_t nSttSkewhitInMCTrack[MAXTRACKSPEREVENT]
Double_t BETA[MAXTRACKSPEREVENT]
Double_t S_SciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHits]
Double_t veritaMC[nmaxHits][3]
Double_t radiaConf[nRdivConformal]
Short_t nSciTilHitsinTrack[MAXTRACKSPEREVENT]
Double_t CyMC[MAXTRACKSPEREVENT]
Short_t ListSciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHitsinTrack]
bool TypeConf[MAXTRACKSPEREVENT]
Double_t ALFA[MAXTRACKSPEREVENT]
Short_t nHitsInMCTrack[MAXTRACKSPEREVENT]
bool InclusionListSciTil[nmaxSciTilHits]
bool PndSttTrackFinderReal::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  Ox,
Double_t  Oy,
Double_t  R,
Short_t *  Nintersections,
Double_t  XintersectionList[2],
Double_t  YintersectionList[2],
Double_t distance 
)
private

Definition at line 11746 of file PndSttTrackFinderReal.cxx.

References a, b, c, Double_t, R, sqrt(), status, x, and y.

Referenced by IntersectionSciTil_Circle(), IntersectionsWithClosedbiHexagonLeft(), IntersectionsWithClosedbiHexagonRight(), IntersectionsWithClosedPolygon(), and IntersectionsWithOpenPolygon().

11762 {
11763 
11764 // this method finds the intersection of a circle with a segment. If the circle
11765 // passes through an endpoint of the segment, that is considered an intersection also.
11766 
11767  bool status;
11768 
11769  Short_t ipossibility;
11770 
11771  Double_t aperp,
11772  bperp,
11773  cperp,
11774  det,
11775  distq,
11776  dist1,
11777  dist2,
11778  length,
11779  length_segmentq,
11780  Rq,
11781  x,
11782  y,
11783  Xintersection,
11784  Yintersection;
11785 
11786  *Nintersections=0;
11787  det = a*a+b*b ;
11788  if(det < 1.e-20){
11789  cout<<"from PndSttTrackFinderReal::IntersectionCircle_Segment :"
11790  <<" this is not the equation of a segment, return!\n";
11791  return false;
11792  }
11793  // find if intersection circle - segment is possible.
11794 
11795  // check if there is an intersection (with the squares, it's the same!).
11796  distq = ( a*Ox+ b*Oy + c )*( a*Ox+ b*Oy + c )/det;
11797  *distance = sqrt(distq);
11798  Rq=R*R;
11799  length = Rq - distq;
11800  if(length <= 0. ) return false; // no intersection between trajectory and this
11801  // segment.
11802  length = sqrt(length);
11803  // coefficients of line perpendicular to input segment and passing for (Ox, Oy).
11804  aperp = -b;
11805  bperp = a;
11806  cperp = - aperp*Ox - bperp*Oy;
11807 
11808  // find intersection of segment with perpendicular : no need to check if
11809  // det is different from 0.
11810  Xintersection = (-bperp*c + b*cperp)/det;
11811  Yintersection = (-a*cperp + aperp*c)/det;
11812  det = sqrt(det);
11813  length_segmentq = (P1x-P2x)*(P1x-P2x) + (P1y-P2y)*(P1y-P2y);
11814 
11815  status = false;
11816  for(ipossibility=-1;ipossibility<2;ipossibility +=2){
11817  x = Xintersection + ipossibility*length*b/det ;
11818  y = Yintersection - ipossibility*length*a/det ;
11819  if ( (x-P1x)*(x-P1x)+(y-P1y)*(y-P1y) > length_segmentq
11820  ||
11821  (x-P2x)*(x-P2x)+(y-P2y)*(y-P2y) > length_segmentq
11822  ) continue;
11823  status = true;
11824  XintersectionList[*Nintersections] = x;
11825  YintersectionList[*Nintersections] = y;
11826  (*Nintersections)++;
11827  } // end of for(ipossibility=-1; ...
11828 
11829 
11830  return status;
11831 }
TTree * b
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t a
Definition: anaLmdDigi.C:126
Double_t
Double_t x
Double_t y
Double_t R
Definition: checkhelixhit.C:61
int status[10]
Definition: f_Init.h:28
bool PndSttTrackFinderReal::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] 
)
private

Definition at line 13723 of file PndSttTrackFinderReal.cxx.

References DIMENSIONSCITIL, Double_t, IntersectionCircle_Segment(), and sqrt().

Referenced by AssociateSciTilHit().

13733 {
13734 
13735  bool intersect;
13736 
13737  Double_t
13738  distance,
13739  QQ,
13740  sqrtRR,
13741  SIGN;
13742 
13743 
13744  QQ = posizSciTilx*posizSciTilx+posizSciTily*posizSciTily;
13745  sqrtRR=sqrt(QQ);
13746 
13747  if( posizSciTily<0.) SIGN=-1.;
13748  else SIGN=1.;
13749 
13750 
13751  intersect = IntersectionCircle_Segment(
13752  posizSciTilx,
13753  posizSciTily,
13754  -QQ,
13755  posizSciTilx-SIGN*0.5*DIMENSIONSCITIL*posizSciTily/sqrtRR,
13756  posizSciTilx+SIGN*0.5*DIMENSIONSCITIL*posizSciTily/sqrtRR,
13757  posizSciTily-SIGN*posizSciTilx*0.5*DIMENSIONSCITIL/sqrtRR,
13758  posizSciTily+SIGN*posizSciTilx*0.5*DIMENSIONSCITIL/sqrtRR,
13759  Oxx,
13760  Oyy,
13761  Rr,
13762  Nintersections, // output
13763  XintersectionList, // output
13764  YintersectionList, // output
13765  &distance // output
13766  );
13767 
13768  return intersect;
13769 }
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
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 Ox, Double_t Oy, Double_t R, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
Double_t
static const Double_t DIMENSIONSCITIL
Short_t PndSttTrackFinderReal::IntersectionsWithClosedbiHexagonLeft ( Double_t  vgap,
Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  Ami,
Double_t  Ama,
Short_t *  nIntersections,
Double_t XintersectionList,
Double_t YintersectionList 
)
private

Definition at line 11472 of file PndSttTrackFinderReal.cxx.

References a, b, c, Double_t, i, IntersectionCircle_Segment(), is, IsInternal(), and sqrt().

Referenced by FindTrackEntranceExitbiHexagonLeft().

11485 {
11486 
11487 
11488  // return integer convention :
11489  // -1 --> track outside outer perimeter;
11490  // 0 --> at least 1 intersection with polygon;
11491  // 1 --> track contained completely between the two polygons;
11492 
11493 
11494  // inner Hexagon --> 0
11495  // outer Hexagon --> 1
11496 
11497  bool internal,
11498  AtLeast1;
11499 
11500  Short_t i,
11501  is,
11502  j,
11503  Nintersections;
11504 
11505  Double_t aaa,
11506  maxdistq,
11507  distance,
11508  //-------------------
11509  // a,b,c == coefficients of the implicit equations of the 3 sides of the half inner Hexagon
11510  // plus 3 sides of the half outer Hexagon plus 2 vertical sides corresponding to the Gap :
11511  // a*x + b*y +c =0; the numbering of these 8 sides foolows the convention of Gianluigi's
11512  // logbook on page 286.
11513 a[] = {-1./sqrt(3.) , 1., 1./sqrt(3.), 1., 1./sqrt(3.), 1., -1./sqrt(3.), 1.},
11514 b[] = {1., 0., 1., 0., 1., 0., 1., 0.},
11515 c[] = {-2.*Ama/sqrt(3.),Ama, 2.*Ama/sqrt(3.),vgap/2.,2.*Ami/sqrt(3.),Ami, -2.*Ami/sqrt(3.),vgap/2.},
11516  //----------------------
11517 
11518  tempX[2],
11519  tempY[2];
11520 
11521  // side_x and side_y are ordered as side1, side2, ..... in Gianluigi's logbook on page 286.
11522  Double_t
11523  side_x[] = { -vgap/2., -Ama , -Ama, -vgap/2., -vgap/2., -Ami,
11524  -Ami, -vgap/2., -vgap/2.},
11525  side_y[] = {(-0.5*vgap+2.*Ama)/sqrt(3.), Ama/sqrt(3.), -Ama/sqrt(3.),
11526  -(-0.5*vgap+2.*Ama)/sqrt(3.), -(-0.5*vgap+2.*Ami)/sqrt(3.),
11527  -Ami/sqrt(3.), Ami/sqrt(3.), (-0.5*vgap+2.*Ami)/sqrt(3.),
11528  (-0.5*vgap+2.*Ama)/sqrt(3.) };
11529 
11530 
11531 
11532 //-----------------------
11533 
11534 // find intersections (maximum 16) with the 8 sides.
11535 
11536 
11537 
11538  AtLeast1 = false;
11539  *nIntersections =0;
11540  internal = true;
11541  maxdistq=-9999.;
11542  for(is=0; is<8; is++){
11543  aaa = (side_x[is]-Ox)*(side_x[is]-Ox)+(side_y[is]-Oy)*(side_y[is]-Oy);
11544  if(aaa>maxdistq) maxdistq=aaa;
11545  aaa = (side_x[is+1]-Ox)*(side_x[is+1]-Ox)+(side_y[is+1]-Oy)*(side_y[is+1]-Oy);
11546  if(aaa>maxdistq) maxdistq=aaa;
11548  a[is],
11549  b[is],
11550  c[is],
11551  side_x[is],
11552  side_x[is+1],
11553  side_y[is],
11554  side_y[is+1],
11555  Ox,
11556  Oy,
11557  R,
11558  &Nintersections,
11559  tempX,
11560  tempY,
11561  &distance // distance of (Ox,Oy) from line
11562  // defined by a*x+b*y+c=0.
11563  )
11564  ){
11565  AtLeast1=true;
11566  for(j=0;j<Nintersections;j++){
11567  XintersectionList[ *nIntersections ] =tempX[j];
11568  YintersectionList[ *nIntersections ] =tempY[j];
11569  (*nIntersections)++;
11570  }
11571  } // end of if ( IntersectionCircle_Segment( .....
11572 
11573 
11574  // the definition of 'internal' here is when the given Point
11575  // stays at the same side of the origin (0,0) with respect to
11576  // the given line of equation a*x+b*y+c=0.
11577  if(is<3) {
11578  internal = internal && IsInternal(Ox,
11579  Oy,
11580  a[is],
11581  b[is],
11582  c[is]
11583  );
11584  } else {
11585  internal = internal && (!IsInternal(Ox,
11586  Oy,
11587  a[is],
11588  b[is],
11589  c[is]
11590  ) );
11591  }
11592 
11593  } // end of for(is=0; is<8; is++)
11594 
11595 
11596  if( !AtLeast1){
11597  if (!internal) return -1;// trajectory outside polygon.
11598  if( maxdistq < R*R ) return -1;// trajectory outside polygon.
11599  return 1; // trajectory completely contained inside this Polygon.
11600  }
11601  return 0;
11602 
11603 }
Int_t i
Definition: run_full.C:25
TTree * b
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
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 Ox, Double_t Oy, Double_t R, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
Int_t a
Definition: anaLmdDigi.C:126
Double_t
static int is
Definition: ranlxd.cxx:374
bool IsInternal(Double_t Px, Double_t Py, Double_t Xtraslation, Double_t Ytraslation, Double_t Theta)
Double_t R
Definition: checkhelixhit.C:61
Short_t PndSttTrackFinderReal::IntersectionsWithClosedbiHexagonRight ( Double_t  vgap,
Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  Ami,
Double_t  Ama,
Short_t *  nIntersections,
Double_t XintersectionList,
Double_t YintersectionList 
)
private

Definition at line 11609 of file PndSttTrackFinderReal.cxx.

References a, b, c, Double_t, i, IntersectionCircle_Segment(), is, IsInternal(), and sqrt().

Referenced by FindTrackEntranceExitbiHexagonRight().

11622 {
11623 
11624 
11625  // return integer convention :
11626  // -1 --> track outside outer perimeter;
11627  // 0 --> at least 1 intersection with polygon;
11628  // 1 --> track contained completely between the two polygons;
11629 
11630 
11631  // inner Hexagon --> 0
11632  // outer Hexagon --> 1
11633 
11634  bool internal,
11635  AtLeast1;
11636 
11637  Short_t i,
11638  is,
11639  j,
11640  Nintersections;
11641 
11642  Double_t aaa,
11643  maxdistq,
11644  distance,
11645  //-------------------
11646  // a,b,c == coefficients of the implicit equations of the 3 sides of the half inner Hexagon
11647  // plus 3 sides of the half outer Hexagon plus 2 vertical sides corresponding to the Gap :
11648  // a*x + b*y +c =0; the numbering of these 8 sides foolows the convention of Gianluigi's
11649  // logbook on page 286.
11650 a[] = {1./sqrt(3.) , 1., -1./sqrt(3.), 1., -1./sqrt(3.), 1., 1./sqrt(3.), 1.},
11651 b[] = {1., 0., 1., 0., 1., 0., 1., 0.},
11652 c[] = {-2.*Ama/sqrt(3.),-Ama, 2.*Ama/sqrt(3.),-vgap/2.,2.*Ami/sqrt(3.),-Ami, -2.*Ami/sqrt(3.),-vgap/2.},
11653  //----------------------
11654 
11655  tempX[2],
11656  tempY[2];
11657 
11658  // side_x and side_y are ordered as side1, side2, ..... in Gianluigi's logbook on page 286.
11659  Double_t
11660  side_x[] = { vgap/2., Ama , Ama, vgap/2., vgap/2., Ami,
11661  Ami, vgap/2., vgap/2.},
11662  side_y[] = {(-0.5*vgap+2.*Ama)/sqrt(3.), Ama/sqrt(3.), -Ama/sqrt(3.),
11663  -(-0.5*vgap+2.*Ama)/sqrt(3.), -(-0.5*vgap+2.*Ami)/sqrt(3.),
11664  -Ami/sqrt(3.), Ami/sqrt(3.), (-0.5*vgap+2.*Ami)/sqrt(3.),
11665  (-0.5*vgap+2.*Ama)/sqrt(3.) };
11666 
11667 
11668 
11669 //-----------------------
11670 
11671 // find intersections (maximum 16) with the 8 sides.
11672 
11673 
11674 
11675  AtLeast1 = false;
11676  *nIntersections =0;
11677  internal = true;
11678  maxdistq=-9999.;
11679  for(is=0; is<8; is++){
11680  aaa = (side_x[is]-Ox)*(side_x[is]-Ox)+(side_y[is]-Oy)*(side_y[is]-Oy);
11681  if(aaa>maxdistq) maxdistq=aaa;
11682  aaa = (side_x[is+1]-Ox)*(side_x[is+1]-Ox)+(side_y[is+1]-Oy)*(side_y[is+1]-Oy);
11683  if(aaa>maxdistq) maxdistq=aaa;
11685  a[is],
11686  b[is],
11687  c[is],
11688  side_x[is],
11689  side_x[is+1],
11690  side_y[is],
11691  side_y[is+1],
11692  Ox,
11693  Oy,
11694  R,
11695  &Nintersections,
11696  tempX,
11697  tempY,
11698  &distance // distance of (Ox,Oy) from line
11699  // defined by a*x+b*y+c=0.
11700  )
11701  ){
11702  AtLeast1=true;
11703  for(j=0;j<Nintersections;j++){
11704  XintersectionList[ *nIntersections ] =tempX[j];
11705  YintersectionList[ *nIntersections ] =tempY[j];
11706  (*nIntersections)++;
11707  }
11708  } // end of if ( IntersectionCircle_Segment( .....
11709 
11710 
11711  // the definition of 'internal' here is when the given Point
11712  // stays at the same side of the origin (0,0) with respect to
11713  // the given line of equation a*x+b*y+c=0.
11714  if(is<3) {
11715  internal = internal && IsInternal(Ox,
11716  Oy,
11717  a[is],
11718  b[is],
11719  c[is]
11720  );
11721  } else {
11722  internal = internal && (!IsInternal(Ox,
11723  Oy,
11724  a[is],
11725  b[is],
11726  c[is]
11727  ) );
11728  }
11729 
11730  } // end of for(is=0; is<8; is++)
11731 
11732 
11733  if( !AtLeast1){
11734  if (!internal) return -1;// trajectory outside polygon.
11735  if( maxdistq < R*R ) return -1;// trajectory outside polygon.
11736  return 1; // trajectory completely contained inside this Polygon.
11737  }
11738  return 0;
11739 
11740 }
Int_t i
Definition: run_full.C:25
TTree * b
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
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 Ox, Double_t Oy, Double_t R, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
Int_t a
Definition: anaLmdDigi.C:126
Double_t
static int is
Definition: ranlxd.cxx:374
bool IsInternal(Double_t Px, Double_t Py, Double_t Xtraslation, Double_t Ytraslation, Double_t Theta)
Double_t R
Definition: checkhelixhit.C:61
Short_t PndSttTrackFinderReal::IntersectionsWithClosedPolygon ( Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  Rmi,
Double_t  Rma,
Short_t  nIntersections[2],
Double_t  XintersectionList[][2],
Double_t  YintersectionList[][2] 
)
private

Definition at line 11250 of file PndSttTrackFinderReal.cxx.

References a, b, c, Double_t, i, IntersectionCircle_Segment(), is, IsInternal(), and sqrt().

Referenced by FindTrackEntranceExitbiHexagon(), and FindTrackEntranceExitHexagonCircle().

11262 {
11263 
11264 
11265  // return integer convention :
11266  // -2 --> track outside outer polygon;
11267  // -1 --> track contained completely within inner polygon;
11268  // 0 --> at least 1 intersection with inner polygon, at least 1 with outer polygon;
11269  // 1 --> track contained completely between the two polygons;
11270  // 2 --> track contained completely by larger polygons, with intersections in the smaller;
11271  // 3 --> track completely outsiede the small polygon with intersections in the bigger.
11272 
11273 
11274  // inner Hexagon --> 0
11275  // outer Hexagon --> 1
11276 
11277  bool internal[2],
11278  AtLeast1[2];
11279 
11280  Short_t i,
11281  is,
11282  j,
11283  Nintersections;
11284 
11285  Double_t mindist[2],
11286  distance,
11287  //-------------------
11288  // a,b,c == coefficients of the implicit equations of the six sides of the Hexagon
11289  // centered at 0 : a*x + b*y +c =0; see Gianluigi's logbook on page 277;
11290  // the coefficient c has to be multiplied by Erre.
11291  // The first side is
11292  a[] = { 1./sqrt(3.) , 1., -1./sqrt(3.), 1./sqrt(3.) , 1. , -1./sqrt(3.) } ,
11293  b[] = { 1., 0. , 1., 1., 0. , 1. },
11294  c[] = { -2./sqrt(3.) , -1., 2./sqrt(3.), 2./sqrt(3.), 1., -2./sqrt(3.)},
11295  //----------------------
11296 
11297  Erre[] = {Rmi, Rma}, // this is the distance from (0,0)
11298  // of the Verteces of the Hexagon delimiting the Skew area
11299  tempX[2],
11300  tempY[2];
11301 
11302  // both hexagon_side_xlow and hexagon_side_xup must be multiplied by appropriate Erre;
11303  // sides of Hexagon ordered as a, b, c ..... in Gianluigi's logbook on page 280.
11304  Double_t
11305  hexagon_side_x[] = { 0., 1. , 1., 0., -1., -1., 0. },
11306  hexagon_side_y[] = { 2./sqrt(3.),1./sqrt(3.),-1./sqrt(3.),
11307  -2./sqrt(3.),-1./sqrt(3.), 1./sqrt(3.), 2./sqrt(3.)};
11308 
11309 
11310 
11311 //-----------------------
11312 
11313 // find intersection with the 6 sides of the small exhagon delimiting the skew straws zone
11314 // see on page 277 of Gianluigi's logbook.
11315 
11316  // status =0, at least 1 intersection with inner Hexagon, at least 1 intersection
11317  // with the outer Hexagon; =1, track contained completely between the
11318  // two Hexagons; = -1 track contained within inner Hexagon;
11319  // =-2 track outside outer Hexagon.
11320 
11321 
11322  for(i=0;i<2;i++){ // i=0 --> inner Hexagon, i= 1 --> outer Hexagon.
11323  AtLeast1[i] = false;
11324  nIntersections[i]=0;
11325  internal[i] = true;
11326  mindist[i]=999999.;
11327  for(is=0; is<6; is++){
11328  if ( IntersectionCircle_Segment(a[is],
11329  b[is],
11330  c[is]*Erre[i],
11331  hexagon_side_x[is]*Erre[i],
11332  hexagon_side_x[is+1]*Erre[i],
11333  hexagon_side_y[is]*Erre[i],
11334  hexagon_side_y[is+1]*Erre[i],
11335  Ox,
11336  Oy,
11337  R,
11338  &Nintersections,
11339  tempX,
11340  tempY,
11341  &distance // distance of (Ox,Oy) from line
11342  // defined by a*x+b*y+c=0.
11343  )
11344  ){
11345  AtLeast1[i]=true;
11346  for(j=0;j<Nintersections;j++){
11347  XintersectionList[ nIntersections[i] ][i] =tempX[j];
11348  YintersectionList[ nIntersections[i] ][i] =tempY[j];
11349  nIntersections[i]++;
11350  }
11351  } // end of if ( IntersectionCircle_Segment( .....
11352 
11353  if(mindist[i]>distance) mindist[i]=distance;
11354 
11355  // the definition of 'internal' here is when the given Point
11356  // stays at the same side of the origin (0,0) with respect to
11357  // the given line of equation a*x+b*y+c=0.
11358  internal[i] = internal[i] && IsInternal(Ox,
11359  Oy,
11360  a[is],
11361  b[is],
11362  c[is]*Erre[i]
11363  );
11364 
11365  } // end of for(is=0; is<6; is++)
11366  } // end of for(i=0;i<2;i++)
11367 
11368 
11369  if( (!AtLeast1[0]) && (!AtLeast1[1]) ){
11370  if (!internal[1]) return -2; // trajectory outside outer Hexagon.
11371  if( R > mindist[1]) return -2;
11372  if( !internal[0]) return 1; // trajectory contained between inner and outer Hexagon.
11373  if( mindist[0] >= R) return -1; // trajectory contained in inner Hexagon.
11374  return 1; // trajectory contained between inner and outer Hexagon.
11375  } else if (AtLeast1[0] && AtLeast1[1] ){ // continuation of if( (!AtLeast1[0]) && ...
11376  return 0;
11377  } else if (AtLeast1[0]){
11378  return 2;
11379  }
11380 
11381  return 3;
11382 }
Int_t i
Definition: run_full.C:25
TTree * b
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
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 Ox, Double_t Oy, Double_t R, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
Int_t a
Definition: anaLmdDigi.C:126
Double_t
static int is
Definition: ranlxd.cxx:374
bool IsInternal(Double_t Px, Double_t Py, Double_t Xtraslation, Double_t Ytraslation, Double_t Theta)
Double_t R
Definition: checkhelixhit.C:61
Short_t PndSttTrackFinderReal::IntersectionsWithGapSemicircle ( Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Double_t  gap,
bool  left,
Double_t  Rma,
Double_t XintersectionList,
Double_t YintersectionList 
)
private

Definition at line 11839 of file PndSttTrackFinderReal.cxx.

References acos(), atan2(), cos(), Double_t, sin(), and sqrt().

Referenced by FindTrackEntranceExitHexagonCircleLeft(), and FindTrackEntranceExitHexagonCircleRight().

11849 {
11850 
11851  Short_t nIntersectionsCircle;
11852 
11853  Double_t cosFi,
11854  theta1,
11855  theta2,
11856  Theta1,
11857  Theta2,
11858  aaa,
11859  Fi,
11860  FI0,
11861  x1,
11862  x2,
11863  y1,
11864  y2;
11865 
11866 
11867 
11868  nIntersectionsCircle=0;
11869  aaa = sqrt(Oxx*Oxx+Oyy*Oyy);
11870 
11871  // preliminary condition for having intersections between trajectory and Circle.
11872 
11873  if( !( aaa >= Rr + Rma || Rr >= aaa + Rma) &&
11874  !( aaa + Rr <= Rma || aaa - Rr >= Rma ) ) {
11875 
11876 // now the calculation
11877 
11878  FI0 = atan2(-Oyy,-Oxx);
11879  cosFi = (aaa*aaa + Rr*Rr - Rma*Rma)/(2.*Rr*aaa);
11880  if(cosFi<-1.) cosFi=-1.; else if(cosFi>1.) cosFi=1.;
11881  Fi = acos(cosFi);
11882 
11883 
11884  // (x1, y1) and (x2,y2) are the intersections between the trajectory
11885  // and the circle, in the laboratory reference frame.
11886  x1 = Oxx+Rr*cos(FI0 - Fi);
11887  y1 = Oyy+Rr*sin(FI0 - Fi);
11888  theta1 = atan2(y1,x1); // in this way theta1 is between -PI and PI.
11889  x2 = Oxx+Rr*cos(FI0 + Fi);
11890  y2 = Oyy+Rr*sin(FI0 + Fi);
11891  theta2 = atan2(y2,x2); // in this way theta2 is between -PI and PI.
11892  // Theta1, Theta2 = angle of the edges of the outer circle + Gap in the laboratory frame.
11893  // Theta1, Theta2 are angles between -PI/2 and +PI/2.
11894  if(!left){ // Right (looking into the beam) Semicircle.
11895  Theta2 = atan2( sqrt(Rma*Rma-GAP*GAP/4.),GAP/2.);
11896  Theta1 = atan2( -sqrt(Rma*Rma-GAP*GAP/4.),GAP/2.);
11897  if( Theta1<= theta1 && theta1 <= Theta2 ){
11898  XintersectionList[nIntersectionsCircle]=x1;
11899  YintersectionList[nIntersectionsCircle]=y1;
11900  nIntersectionsCircle++;
11901  }
11902  if( Theta1<= theta2 && theta2 <= Theta2 ){
11903  XintersectionList[nIntersectionsCircle]=x2;
11904  YintersectionList[nIntersectionsCircle]=y2;
11905  nIntersectionsCircle++;
11906  }
11907  } else { // Left (looking into the beam) Semicircle.
11908  Theta2 = atan2( -sqrt(Rma*Rma-GAP*GAP/4.),-GAP/2.);
11909  Theta1 = atan2( sqrt(Rma*Rma-GAP*GAP/4.),-GAP/2.);
11910  if( Theta1<= theta1 || theta1 <= Theta2 ){
11911  XintersectionList[nIntersectionsCircle]=x1;
11912  YintersectionList[nIntersectionsCircle]=y1;
11913  nIntersectionsCircle++;
11914  }
11915  if( Theta1<= theta2 || theta2 <= Theta2 ){
11916  XintersectionList[nIntersectionsCircle]=x2;
11917  YintersectionList[nIntersectionsCircle]=y2;
11918  nIntersectionsCircle++;
11919  }
11920  }
11921 
11922  } // end of if (!( a >= Rr + Rma || .....
11923 
11924 //---------------------------- end of calculation intersection with outer circle.
11925 
11926  return nIntersectionsCircle;
11927 
11928 
11929 }
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Short_t PndSttTrackFinderReal::IntersectionsWithOpenPolygon ( Double_t  Ox,
Double_t  Oy,
Double_t  R,
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 
)
private

Definition at line 11390 of file PndSttTrackFinderReal.cxx.

References Double_t, i, IntersectionCircle_Segment(), and is.

Referenced by FindTrackEntranceExitHexagonCircleLeft(), and FindTrackEntranceExitHexagonCircleRight().

11405 {
11406 
11407  // this methods returns the n. of intersections.
11408 
11409 
11410 
11411  Short_t i,
11412  is,
11413  j,
11414  nIntersections,
11415  Nintersections;
11416 
11417  Double_t mindist,
11418  distance,
11419  //-------------------
11420  // a,b,c == coefficients of the implicit equations of the six sides of the Hexagon
11421  // centered at 0 : a*x + b*y +c =0; see Gianluigi's logbook on page 277;
11422  // the coefficient c has to be multiplied by Erre.
11423 
11424  tempX[2],
11425  tempY[2];
11426 
11427 
11428 
11429 
11430 //-----------------------
11431 
11432  nIntersections=0;
11433  for(is=0; is<nSides; is++){
11434  if ( IntersectionCircle_Segment(a[is],
11435  b[is],
11436  c[is],
11437  Side_x[is],
11438  Side_x[is+1],
11439  Side_y[is],
11440  Side_y[is+1],
11441  Ox,
11442  Oy,
11443  R,
11444  &Nintersections,
11445  tempX,
11446  tempY,
11447  &distance // distance of (Ox,Oy) from line
11448  // defined by a*x+b*y+c=0.
11449  )
11450  ){
11451  for(j=0;j<Nintersections;j++){
11452  XintersectionList[ nIntersections ] =tempX[j];
11453  YintersectionList[ nIntersections ] =tempY[j];
11454  nIntersections += Nintersections;
11455  }
11456  } // end of if ( IntersectionCircle_Segment( .....
11457 
11458 
11459  } // end of for(is=0; is<nSides; is++)
11460 // } // end of for(i=0;i<2;i++)
11461 
11462 
11463 
11464  return nIntersections;
11465 }
Int_t i
Definition: run_full.C:25
TTree * b
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 Ox, Double_t Oy, Double_t R, Short_t *Nintersections, Double_t XintersectionList[2], Double_t YintersectionList[2], Double_t *distance)
Int_t a
Definition: anaLmdDigi.C:126
Double_t
static int is
Definition: ranlxd.cxx:374
Double_t R
Definition: checkhelixhit.C:61
bool PndSttTrackFinderReal::iscontiguous ( int  ncomponents,
Short_t *  vec1,
Short_t *  vec2 
)
private

Definition at line 3258 of file PndSttTrackFinderReal.cxx.

References i.

Referenced by clustering2(), and clustering3().

3260 {
3261 
3262  for(int i=0; i<ncomponents;i++){
3263  if( vec1[i]-vec2[i] >3 || vec1[i]-vec2[i]<-3) return false;
3264  }
3265 
3266  return true;
3267 
3268 }
Int_t i
Definition: run_full.C:25
bool PndSttTrackFinderReal::IsInsideArc ( Double_t  Oxx,
Double_t  Oyy,
Short_t  Charge,
Double_t  Xcross[2],
Double_t  Ycross[2],
Double_t  Spoint 
)
private

Definition at line 12946 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, f1, f2, and PI.

12954 {
12955 
12956  Double_t f1,
12957  f2;
12958 
12959 
12960  // Xcross[0],Ycross[0] is the point of entrance.
12961 
12962 
12963  f1 = atan2(Ycross[0]-Oyy, Xcross[0]-Oxx);
12964  if(f1<0.) f1+= 2.*PI;
12965  if(f1<0.) f1= 0.;
12966  f2 = atan2(Ycross[1]-Oyy, Xcross[1]-Oxx);
12967  if(f2<0.) f2+= 2.*PI;
12968  if(f2<0.) f2= 0.;
12969 
12970 
12971 
12972  if(Charge<0){
12973  if(f1 > f2 ) f2 +=2.*PI;
12974  if(f1 > f2 ) f2 = f1;
12975  if( f>f1){
12976  if(f<f2) return true; else return false;
12977  } else {
12978  f +=2.*PI;
12979  if(f<f1) f= f1;
12980  if(f<f2) return true; else return false;
12981  }
12982  } else { // Charge > 0.
12983  if(f1 < f2 ) f1 +=2.*PI;
12984  if(f1 < f2 ) f1 = f2;
12985  if( f>f2){
12986  if(f<f1) return true; else return false;
12987  } else {
12988  f +=2.*PI;
12989  if(f<f2) f= f2;
12990  if(f<f1) return true; else return false;
12991  }
12992  } // end of if(Charge<0)
12993 }
TF1 * f1
Definition: reco_analys2.C:50
Double_t
TFile * f
Definition: bump_analys.C:12
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
TFile * f2
bool PndSttTrackFinderReal::IsInTargetPipe ( Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Double_t  fi0,
Double_t  kappa,
Short_t  charge,
Double_t  gap 
)
private
bool PndSttTrackFinderReal::IsInternal ( Double_t  Px,
Double_t  Py,
Double_t  Xtraslation,
Double_t  Ytraslation,
Double_t  Theta 
)
private

Definition at line 11936 of file PndSttTrackFinderReal.cxx.

References cos(), and sin().

Referenced by IntersectionsWithClosedbiHexagonLeft(), IntersectionsWithClosedbiHexagonRight(), and IntersectionsWithClosedPolygon().

11943 {
11944 
11945 
11946  // for explanations see Gianluigi's logbook on page 278-280.
11947 
11948  if( (Xtraslation-Px)*sin(Theta) + (Py-Ytraslation)*cos(Theta) >= 0. ) return true;
11949  else return false;
11950 
11951 
11952 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
void PndSttTrackFinderReal::Merge ( Short_t  nl,
Double_t left,
Short_t *  ind_left,
Short_t  nr,
Double_t right,
Short_t *  ind_right,
Double_t result,
Short_t *  ind 
)
private

Definition at line 5886 of file PndSttTrackFinderReal.cxx.

References i.

Referenced by Merge_Sort().

5888 {
5889  Short_t i =0, j, nl_curr=0, nr_curr=0;
5890 
5891  while( nl > 0 && nr >0){
5892  if( left[nl_curr] <= right[nr_curr]){
5893  result[i] = left[nl_curr];
5894  ind[i] = ind_left[nl_curr];
5895  nl--;
5896  nl_curr++;
5897  } else {
5898  result[i] = right [nr_curr];
5899  ind[i] = ind_right [nr_curr];
5900  nr--;
5901  nr_curr++;
5902  }
5903  i++;
5904  }
5905 //--------------------
5906  if( nl ==0) {
5907  for(j=0; j<nr; j++){
5908  result[i+j]= right[nr_curr+j];
5909  ind[i+j]= ind_right[nr_curr+j];
5910  }
5911  } else {
5912  for(j=0; j<nl; j++){
5913  result[i+j]= left[nl_curr+j];
5914  ind[i+j]= ind_left[nl_curr+j];
5915  }
5916  }
5917 
5918 
5919 
5920 
5921 
5922 }
Int_t i
Definition: run_full.C:25
void PndSttTrackFinderReal::Merge_Sort ( Short_t  n_ele,
Double_t array,
Short_t *  ind 
)
private

Definition at line 5830 of file PndSttTrackFinderReal.cxx.

References Double_t, i, and Merge().

Referenced by ChooseEntranceExit(), ChooseEntranceExitbis(), DoFind(), OrderingUsingConformal(), PndSttOrdering(), PndSttOrderingParallel(), and PndSttOrderingSkewandParallel().

5831 {
5832 
5833 
5834 // this method orders a set of numbers from smaller to biggers; smaller numbers come first.
5835 // The vector : array is going to be changed, and also the vector ind will be changed
5836 // accordingly.
5837 
5838 
5839  Short_t nr, nl, middle, i,
5840  ind_left[n_ele], ind_right[n_ele];
5841 
5842  Double_t left[n_ele], right[n_ele], result[n_ele];
5843 
5844  if( n_ele <= 1) return;
5845 
5846  middle = n_ele/2 ;
5847  for(i=0; i<middle; i++){
5848  left[i]=array[i];
5849  ind_left[i]= ind[i];
5850  }
5851  for(i=middle; i<n_ele; i++){
5852  right[i-middle]=array[i];
5853  ind_right[i-middle]= ind[i];
5854  }
5855 
5856  Merge_Sort( middle, left, ind_left);
5857  Merge_Sort(n_ele-middle, right, ind_right);
5858 
5859  if( left[middle-1] > right[0]) {
5860  Merge(middle, left,ind_left, n_ele-middle, right, ind_right, array, ind);
5861  } else {
5862  // do the appending
5863  for(i=0; i<middle; i++){
5864  array[i]=left[i];
5865  ind[i]=ind_left[i];
5866 
5867  }
5868  for(i=middle; i<n_ele; i++){
5869  array[i]=right[i-middle];
5870  ind[i]=ind_right[i-middle];
5871  }
5872  }
5873 
5874 
5875 }
Int_t i
Definition: run_full.C:25
Double_t
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
void Merge(Short_t nl, Double_t *left, Short_t *ind_left, Short_t nr, Double_t *right, Short_t *ind_right, Double_t *result, Short_t *ind)
void PndSttTrackFinderReal::OrderingUsingConformal ( Double_t  oX,
Double_t  oY,
Int_t  nHits,
Double_t  XY[][2],
Int_t  Charge,
Short_t *  ListHits 
)
private

Definition at line 13003 of file PndSttTrackFinderReal.cxx.

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

13011 {
13012 
13013 
13014 
13015 
13016  Short_t i,j,
13017  tmp[nHits];
13018  Double_t aaa,
13019  b1,
13020  firstR2,
13021  lastR2,
13022  aux[nHits],
13023  U[nHits],
13024  V[nHits];
13025 
13026 
13027 
13028 // here there is the ordering of the hits, under the assumption that the circumference
13029 // in XY goes through (0,0).
13030 // Moreover, the code before is supposed to have selected trajectories in XY with (Ox,Oy)
13031 // farther from (0,0) by > 0.9 * RminStrawDetector/2 and consequently Ox and Oy are not both 0.
13032 // The scheme for the ordering of the hit is as follows :
13033 // 1) order hits by increasing U or V of the conformal mapping; see Gianluigi's Logbook page 283;
13034 // 2) find the charge of the track by checking if it is closest to the center in XY
13035 // the first or the last of the ordered hits.
13036 // 3) in case, invert the ordering of U, V and ListHits such that the first hits in the
13037 // list are alway those closer to the (0,0).
13038 
13039 
13040 // ordering of the hits
13041 
13042  aaa = atan2( oY, oX); // atan2 defined between -PI and PI.
13043 
13044  // the following statement is necessary since for unknown reason the root interpreter
13045  // gives a weird error when using PI directly in the if statement below!!!!!!! I lost
13046  // 2 hours trying to figure this out!
13047  b1 = PI/4.;
13048 
13049  if((aaa>b1&&aaa<3.*b1) || (aaa>-3.*b1&&aaa<-b1)){//use U as ordering variable;
13050  //[case 1 or 3 Gianluigi's Logbook page 285].
13051  for (j = 0; j< nHits; j++){
13052  U[j]=XY[j][0]/(XY[j][0]*XY[j][0]+XY[j][1]*XY[j][1]);
13053  }
13054  Merge_Sort( nHits, U, ListHits);
13055 
13056  if((aaa>b1&&aaa<3.*b1)){ // case #1;
13057  if( Charge == -1){
13058  // inverting the order of the hits.
13059  for(i=0;i<nHits;i++){
13060  tmp[i]=ListHits[nHits-1-i];
13061  }
13062  for(i=0;i<nHits;i++){
13063  ListHits[i]=tmp[i];
13064  }
13065  }
13066  } else{ // case # 3.
13067  if(Charge == 1){
13068  // inverting the order of the hits.
13069  for(i=0;i<nHits;i++){
13070  tmp[i]=ListHits[nHits-1-i];
13071  }
13072  for(i=0;i<nHits;i++){
13073  ListHits[i]=tmp[i];
13074  }
13075  }// end of if( Charge ==1)
13076  }// end of if((aaa>b1&&aaa<3.*b1))
13077 
13078  } else { // use V as ordering variable [case 2 or 4 Gianluigi's Logbook page 285].
13079  for (j = 0; j< nHits; j++){
13080  V[j]=XY[j][1]/(XY[j][0]*XY[j][0]+XY[j][1]*XY[j][1]);
13081  }
13082  Merge_Sort( nHits, V, ListHits);
13083 
13084  if((aaa<=-3.*b1 || aaa>=3.*b1)){ // case #2;
13085  if( Charge == -1){
13086  // inverting the order of the hits.
13087  for(i=0;i<nHits;i++){
13088  tmp[i]=ListHits[nHits-1-i];
13089  }
13090  for(i=0;i<nHits;i++){
13091  ListHits[i]=tmp[i];
13092  }
13093  }
13094  } else{ // case # 4.
13095  if( Charge == 1){
13096  // inverting the order of the hits.
13097  for(i=0;i<nHits;i++){
13098  tmp[i]=ListHits[nHits-1-i];
13099  }
13100  for(i=0;i<nHits;i++){
13101  ListHits[i]=tmp[i];
13102  }
13103  }
13104  }
13105 
13106  } // end of if((aaa>b1&& ....
13107 
13108 
13109 
13110  return;
13111 
13112 
13113 }
Int_t i
Definition: run_full.C:25
int nHits
Definition: RiemannTest.C:16
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
void PndSttTrackFinderReal::plottamentiParalleleconMassimo ( char *  tipo,
Int_t  nMaxima,
Int_t  Nremaining,
Float_t *  RemainingR,
Float_t *  RemainingD,
Float_t *  RemainingFi,
Float_t *  RemainingCX,
Float_t *  RemainingCY,
Double_t  Rup,
Double_t  Rlow,
Double_t  Dup,
Double_t  Dlow,
Double_t  Fiup,
Double_t  Filow 
)
private

Definition at line 3158 of file PndSttTrackFinderReal.cxx.

References CXmax, CXmin, CYmax, CYmin, Double_t, i, IVOLTE, jj, nbinCX, nbinCY, nbinD, nbinFi, and nbinR.

3165  {
3166 
3167 
3168  int itemp, i, j, ii, jj;
3169 
3170  Double_t D, Fi;
3171 
3172  char nome[300],titolo[300];
3173 
3174 
3175 
3176  sprintf(nome,"HoughParallele%sMaximumN%devent%d.root",tipo,nMaxima,IVOLTE);
3177  TFile hfile(nome,"RECREATE", "STT pattern recognition");
3178 
3179 
3180 //----------
3181  sprintf(titolo,"CxofcircleSelected");
3182  TH1F hCXsel(titolo,titolo,nbinCX,CXmin,CXmax);
3183 //-----
3184  sprintf(titolo,"CyofcircleSelected");
3185  TH1F hCYsel(titolo,titolo,nbinCY,CYmin,CYmax);
3186 //-----
3187  sprintf(titolo,"RadiusofcircleSelected");
3188  TH1F hRsel(titolo,titolo,nbinR,Rlow,Rup);
3189 //-----
3190  sprintf(titolo,"CxabscissavsCyordinatevsRadiusSelected");
3191  TH3F hCX_CY_Rsel(titolo,titolo,nbinCX,CXmin,CXmax,nbinCY,CYmin,CYmax,nbinR,Rlow,Rup);
3192 //----------
3193  sprintf(titolo,"DistanceofclosestapproachofcircleSelected");
3194  TH1F hDsel(titolo,titolo,nbinD,Dlow,Dup);
3195 //-----
3196  sprintf(titolo,"FiradofcircleSselected");
3197  TH1F hFisel(titolo,titolo,nbinFi,Filow,Fiup);
3198 //-----
3199  sprintf(titolo,"DabscissavsFiSelected");
3200  TH2F hD_Fisel(titolo,titolo,nbinD,Dlow,Dup,nbinFi,Filow,Fiup);
3201 //-----
3202  sprintf(titolo,"DabscissavsRadiusSelected");
3203  TH2F hD_Rsel(titolo,titolo,nbinD,Dlow,Dup,nbinR,Rlow,Rup);
3204 //-----
3205  sprintf(titolo,"FiabscissavsRadiusSelected");
3206  TH2F hFi_Rsel(titolo,titolo,nbinFi,Filow,Fiup,nbinR,Rlow,Rup);
3207 //-----
3208  sprintf(titolo,"DabscissavsFiordinatevsRadiusSelected");
3209  TH3F hD_Fi_Rsel(titolo,titolo,nbinD,Dlow,Dup,nbinFi,Filow,Fiup,nbinR,Rlow,Rup);
3210 
3211 
3212 
3213 
3214  for(itemp = 0; itemp<Nremaining; itemp++){
3215 
3216  D = RemainingD[itemp];
3217  Fi = RemainingFi[itemp];
3218 
3219 
3220  if( RemainingR[itemp]>Rlow && RemainingR[itemp]<Rup
3221  &&
3222  RemainingD[itemp]>Dlow && RemainingD[itemp]<Dup
3223  &&
3224  RemainingFi[itemp]>Filow && RemainingFi[itemp]<Fiup
3225  ) {
3226  hRsel.Fill(RemainingR[itemp]);
3227  hFisel.Fill(Fi);
3228  hDsel.Fill(D);
3229  hCXsel.Fill(RemainingCX[itemp]);
3230  hCYsel.Fill(RemainingCY[itemp]);
3231  hD_Fisel.Fill(D,Fi);
3232  hD_Rsel.Fill(D,RemainingR[itemp]);
3233  hFi_Rsel.Fill(Fi,RemainingR[itemp]);
3234  hD_Fi_Rsel.Fill(D,Fi,RemainingR[itemp]);
3235  hCX_CY_Rsel.Fill(RemainingCX[itemp],RemainingCY[itemp],RemainingR[itemp]);
3236  }
3237 
3238  } // end of for(Int_t itemp = 0; itemp<Nremaining; itemp++)
3239 
3240 
3241 
3242 
3243 
3244 
3245  hfile.Write(nome);
3246  hfile.Close();
3247 
3248  }
Int_t i
Definition: run_full.C:25
static const Short_t nbinCX
static const Short_t nbinFi
static const Double_t CYmax
static const Short_t nbinR
static const Short_t nbinCY
static const Short_t nbinD
static const Double_t CXmin
Double_t
static const Double_t CXmax
static const Double_t CYmin
void PndSttTrackFinderReal::plottamentiParalleleGenerali ( Int_t  Nremaining,
Float_t *  RemainingR,
Float_t *  RemainingD,
Float_t *  RemainingFi,
Float_t *  RemainingCX,
Float_t *  RemainingCY,
bool *  Goodflag 
)
private

Definition at line 2925 of file PndSttTrackFinderReal.cxx.

References CXmax, CXmin, CYmax, CYmin, Dmax, Dmin, Double_t, Fimax, Fimin, i, IVOLTE, jj, nbinCX, nbinCY, nbinD, nbinFi, nbinR, Rmax, and Rmin.

2930 {
2931 
2932 
2933  int itemp, i, j, ii, jj;
2934 
2935  Double_t D, Fi;
2936 
2937  char nome[300],titolo[300];
2938 
2939 
2940 
2941  sprintf(nome,"HoughGeneralPlotsEvent%d.root",IVOLTE);
2942  TFile hfile(nome,"RECREATE", "STT pattern recognition");
2943 
2944 //----------
2945  sprintf(titolo,"Cxofcircle");
2946  TH1F hCX(titolo,titolo,nbinCX,CXmin,CXmax);
2947 //----------
2948  sprintf(titolo,"Cyofcircle");
2949  TH1F hCY(titolo,titolo,nbinCY,CYmin,CYmax);
2950 //-----
2951  sprintf(titolo,"Radiusofcircle");
2952  TH1F hR(titolo,titolo,nbinR,Rmin,Rmax);
2953 //-----
2954  sprintf(titolo,"CxabscissavsCy");
2955  TH2F hCX_CY(titolo,titolo,nbinCX,CXmin,CXmax,nbinCY,CYmin,CYmax);
2956 //-----
2957  sprintf(titolo,"CxabscissavsRadius");
2958  TH2F hCX_R(titolo,titolo,nbinCX,CXmin,CXmax,nbinR,Rmin,Rmax);
2959 //-----
2960  sprintf(titolo,"CyabscissavsRadius");
2961  TH2F hCY_R(titolo,titolo,nbinCY,CYmin,CYmax,nbinR,Rmin,Rmax);
2962 //-----
2963  sprintf(titolo,"CxabscissavsCyordinatevsRadius");
2964  TH3F hCX_CY_R(titolo,titolo,nbinCX,CXmin,CXmax,nbinCY,CYmin,CYmax,nbinR,Rmin,Rmax);
2965 //-----
2966  sprintf(titolo,"Distanceofclosestapproachofcircle");
2967  TH1F hD(titolo,titolo,nbinD,Dmin,Dmax);
2968 //----------
2969  sprintf(titolo,"Firadofcircle");
2970  TH1F hFi(titolo,titolo,nbinFi,Fimin,Fimax);
2971 //-----
2972  sprintf(titolo,"DabscissavsFi");
2973  TH2F hD_Fi(titolo,titolo,nbinD,Dmin,Dmax,nbinFi,Fimin,Fimax);
2974 //-----
2975  sprintf(titolo,"DabscissavsRadius");
2976  TH2F hD_R(titolo,titolo,nbinD,Dmin,Dmax,nbinR,Rmin,Rmax);
2977 //-----
2978  sprintf(titolo,"FiabscissavsRadius");
2979  TH2F hFi_R(titolo,titolo,nbinFi,Fimin,Fimax,nbinR,Rmin,Rmax);
2980 //-----
2981  sprintf(titolo,"DabscissavsFiordinatevsRadius");
2982  TH3F hD_Fi_R(titolo,titolo,nbinD,Dmin,Dmax,nbinFi,Fimin,Fimax,nbinR,Rmin,Rmax);
2983 //-----
2984 
2985 //---------------------------------------------------
2986 // gli stessi plots ma per le soluzioni che sono le piu' vicine alla verita' MC
2987 //----------
2988  sprintf(titolo,"Cxofcircle_truth");
2989  TH1F hCXverita(titolo,titolo,nbinCX,CXmin,CXmax);
2990 //----------
2991  sprintf(titolo,"Cyofcircle_truth");
2992  TH1F hCYverita(titolo,titolo,nbinCY,CYmin,CYmax);
2993 //-----
2994  sprintf(titolo,"Radiusofcircle_truth");
2995  TH1F hRverita(titolo,titolo,nbinR,Rmin,Rmax);
2996 //-----
2997  sprintf(titolo,"CxabscissavsCy_truth");
2998  TH2F hCX_CYverita(titolo,titolo,nbinCX,CXmin,CXmax,nbinCY,CYmin,CYmax);
2999 //-----
3000  sprintf(titolo,"CxabscissavsRadius_truth");
3001  TH2F hCX_Rverita(titolo,titolo,nbinCX,CXmin,CXmax,nbinR,Rmin,Rmax);
3002 //-----
3003  sprintf(titolo,"CyabscissavsRadius_truth");
3004  TH2F hCY_Rverita(titolo,titolo,nbinCY,CYmin,CYmax,nbinR,Rmin,Rmax);
3005 //-----
3006  sprintf(titolo,"CxabscissavsCyordinatevsRadius_truth");
3007  TH3F hCX_CY_Rverita(titolo,titolo,nbinCX,CXmin,CXmax,nbinCY,CYmin,CYmax,nbinR,Rmin,Rmax);
3008 //-----
3009  sprintf(titolo,"Distanceofclosestapproachofcircle_truth");
3010  TH1F hDverita(titolo,titolo,nbinD,Dmin,Dmax);
3011 //----------
3012  sprintf(titolo,"Firadofcircle_truth");
3013  TH1F hFiverita(titolo,titolo,nbinFi,Fimin,Fimax);
3014 //-----
3015  sprintf(titolo,"DabscissavsFi_truth");
3016  TH2F hD_Fiverita(titolo,titolo,nbinD,Dmin,Dmax,nbinFi,Fimin,Fimax);
3017 //-----
3018  sprintf(titolo,"DabscissavsRadius_truth");
3019  TH2F hD_Rverita(titolo,titolo,nbinD,Dmin,Dmax,nbinR,Rmin,Rmax);
3020 //-----
3021  sprintf(titolo,"FiabscissavsRadius_truth");
3022  TH2F hFi_Rverita(titolo,titolo,nbinFi,Fimin,Fimax,nbinR,Rmin,Rmax);
3023 //-----
3024  sprintf(titolo,"DabscissavsFiordinatevsRadius_truth");
3025  TH3F hD_Fi_Rverita(titolo,titolo,nbinD,Dmin,Dmax,nbinFi,Fimin,Fimax,nbinR,Rmin,Rmax);
3026 //-----
3027 
3028 //---------------------------------------------------
3029 // gli stessi plots ma per le soluzioni che NON sono le piu' vicine alla verita' MC
3030 //----------
3031  sprintf(titolo,"Cxofcircle_nontruth");
3032  TH1F hCXnonverita(titolo,titolo,nbinCX,CXmin,CXmax);
3033 //----------
3034  sprintf(titolo,"Cyofcircle_nontruth");
3035  TH1F hCYnonverita(titolo,titolo,nbinCY,CYmin,CYmax);
3036 //-----
3037  sprintf(titolo,"Radiusofcircle_nontruth");
3038  TH1F hRnonverita(titolo,titolo,nbinR,Rmin,Rmax);
3039 //-----
3040  sprintf(titolo,"CxabscissavsCy_nontruth");
3041  TH2F hCX_CYnonverita(titolo,titolo,nbinCX,CXmin,CXmax,nbinCY,CYmin,CYmax);
3042 //-----
3043  sprintf(titolo,"CxabscissavsRadius_nontruth");
3044  TH2F hCX_Rnonverita(titolo,titolo,nbinCX,CXmin,CXmax,nbinR,Rmin,Rmax);
3045 //-----
3046  sprintf(titolo,"CyabscissavsRadius_nontruth");
3047  TH2F hCY_Rnonverita(titolo,titolo,nbinCY,CYmin,CYmax,nbinR,Rmin,Rmax);
3048 //-----
3049  sprintf(titolo,"CxabscissavsCyordinatevsRadius_nontruth");
3050  TH3F hCX_CY_Rnonverita(titolo,titolo,nbinCX,CXmin,CXmax,nbinCY,CYmin,CYmax,nbinR,Rmin,Rmax);
3051 //-----
3052  sprintf(titolo,"Distanceofclosestapproachofcircle_nontruth");
3053  TH1F hDnonverita(titolo,titolo,nbinD,Dmin,Dmax);
3054 //----------
3055  sprintf(titolo,"Firadofcircle_nontruth");
3056  TH1F hFinonverita(titolo,titolo,nbinFi,Fimin,Fimax);
3057 //-----
3058  sprintf(titolo,"DabscissavsFi_nontruth");
3059  TH2F hD_Finonverita(titolo,titolo,nbinD,Dmin,Dmax,nbinFi,Fimin,Fimax);
3060 //-----
3061  sprintf(titolo,"DabscissavsRadius_nontruth");
3062  TH2F hD_Rnonverita(titolo,titolo,nbinD,Dmin,Dmax,nbinR,Rmin,Rmax);
3063 //-----
3064  sprintf(titolo,"FiabscissavsRadius_nontruth");
3065  TH2F hFi_Rnonverita(titolo,titolo,nbinFi,Fimin,Fimax,nbinR,Rmin,Rmax);
3066 //-----
3067  sprintf(titolo,"DabscissavsFiordinatevsRadius_nontruth");
3068  TH3F hD_Fi_Rnonverita(titolo,titolo,nbinD,Dmin,Dmax,nbinFi,Fimin,Fimax,nbinR,Rmin,Rmax);
3069 //-----
3070 
3071 //---------------------------------------------------
3072 
3073 
3074 
3075 
3076 
3077  for(itemp = 0; itemp<Nremaining; itemp++){
3078 
3079  D = RemainingD[itemp];
3080  Fi = RemainingFi[itemp];
3081 
3082 
3083  hCX.Fill(RemainingCX[itemp]);
3084  hCY.Fill(RemainingCY[itemp]);
3085  hR.Fill(RemainingR[itemp]);
3086  hCX_CY.Fill(RemainingCX[itemp],RemainingCY[itemp]);
3087  hCX_R.Fill(RemainingCX[itemp],RemainingR[itemp]);
3088  hCY_R.Fill(RemainingCY[itemp],RemainingR[itemp]);
3089  hCX_CY_R.Fill(RemainingCX[itemp],RemainingCY[itemp],RemainingR[itemp]);
3090 
3091  hD.Fill(D);
3092  hFi.Fill(Fi);
3093  hD_Fi.Fill(D,Fi);
3094  hD_R.Fill(D,RemainingR[itemp]);
3095  hFi_R.Fill(Fi,RemainingR[itemp]);
3096  hD_Fi_R.Fill(D,Fi,RemainingR[itemp]);
3097 
3098 
3099 
3100 
3101 
3102  if (Goodflag[itemp]) {
3103 
3104  hCXverita.Fill(RemainingCX[itemp]);
3105  hCYverita.Fill(RemainingCY[itemp]);
3106  hRverita.Fill(RemainingR[itemp]);
3107  hCX_CYverita.Fill(RemainingCX[itemp],RemainingCY[itemp]);
3108  hCX_Rverita.Fill(RemainingCX[itemp],RemainingR[itemp]);
3109  hCY_Rverita.Fill(RemainingCY[itemp],RemainingR[itemp]);
3110  hCX_CY_Rverita.Fill(RemainingCX[itemp],RemainingCY[itemp],RemainingR[itemp]);
3111 
3112  hDverita.Fill(D);
3113  hFiverita.Fill(Fi);
3114  hD_Fiverita.Fill(D,Fi);
3115  hD_Rverita.Fill(D,RemainingR[itemp]);
3116  hFi_Rverita.Fill(Fi,RemainingR[itemp]);
3117  hD_Fi_Rverita.Fill(D,Fi,RemainingR[itemp]);
3118 
3119  } else {
3120 
3121  hCXnonverita.Fill(RemainingCX[itemp]);
3122  hCYnonverita.Fill(RemainingCY[itemp]);
3123  hRnonverita.Fill(RemainingR[itemp]);
3124  hCX_CYnonverita.Fill(RemainingCX[itemp],RemainingCY[itemp]);
3125  hCX_Rnonverita.Fill(RemainingCX[itemp],RemainingR[itemp]);
3126  hCY_Rnonverita.Fill(RemainingCY[itemp],RemainingR[itemp]);
3127  hCX_CY_Rnonverita.Fill(RemainingCX[itemp],RemainingCY[itemp],RemainingR[itemp]);
3128 
3129  hDnonverita.Fill(D);
3130  hFinonverita.Fill(Fi);
3131  hD_Finonverita.Fill(D,Fi);
3132  hD_Rnonverita.Fill(D,RemainingR[itemp]);
3133  hFi_Rnonverita.Fill(Fi,RemainingR[itemp]);
3134  hD_Fi_Rnonverita.Fill(D,Fi,RemainingR[itemp]);
3135 
3136  }
3137 
3138 
3139 
3140 
3141 
3142  } // end of for(Int_t itemp = 0; itemp<Nremaining; itemp++)
3143 
3144 
3145 
3146 
3147 
3148  hfile.Write(nome);
3149  hfile.Close();
3150 
3151  }
Int_t i
Definition: run_full.C:25
static const Short_t nbinCX
static const Short_t nbinFi
static const Double_t CYmax
static const Double_t Dmax
static const Short_t nbinR
static const Double_t Dmin
static const Short_t nbinCY
static const Short_t nbinD
static const Double_t CXmin
Double_t
static const Double_t Rmin
static const Double_t Rmax
static const Double_t CXmax
static const Double_t CYmin
bool PndSttTrackFinderReal::PndSttAcceptHitsConformal ( Double_t  distance,
Double_t  DriftConfR,
Double_t  StrawConfR 
)
private

Definition at line 6844 of file PndSttTrackFinderReal.cxx.

References fabs().

Referenced by PndSttTrkAssociatedParallelHitsToHelixQuater().

6848 {
6849  if( fabs(distance-DriftConfR) < 2.*StrawConfR ) return true;
6850  return false;
6851 
6852 
6853 }
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void PndSttTrackFinderReal::PndSttBoxConformalFilling ( bool  ExclusionList[nmaxHits],
Double_t  infoparalConformal[][5],
Int_t  Nparal,
Short_t  nBoxConformal[nRdivConformal][nFidivConformal],
Short_t  HitsinBoxConformal[][nRdivConformal][nFidivConformal],
Short_t  RConformalIndex[nmaxHits],
Short_t  FiConformalIndex[nmaxHits] 
)
private

Definition at line 5762 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, i, infoparal, MAXHITSINCELL, nFidivConformal, nRdivConformalEffective, PI, radiaConf, and sqrt().

Referenced by DoFind().

5770 {
5771 
5772  Short_t iR, iFi, i, j;
5773  Double_t Fi;
5774 
5775 
5776 
5777  for(i = 0; i< nRdivConformalEffective ; i++){
5778  for(j = 0; j< nFidivConformal ; j++){
5779  nBoxConformal[i][j]= 0;
5780  }
5781  }
5782 
5783  for(i = 0; i< Nparal ; i++){
5784  if( ! InclusionList[ infoparal[i] ] ) continue;
5785  Fi = atan2(infoparalConformal[i][1],infoparalConformal[i][0]) ;
5786  if ( Fi < 0. ) Fi += 2.*PI;
5787  iFi = (Short_t) (0.5*nFidivConformal*Fi/PI);
5788  if(iFi > nFidivConformal ) {
5789  iFi = nFidivConformal;
5790  } else if (iFi<0) {
5791  iFi = 0;
5792  }
5793 
5794 
5795  Double_t RRR = sqrt(infoparalConformal[i][0]*infoparalConformal[i][0]+
5796  infoparalConformal[i][1]*infoparalConformal[i][1]);
5797 // cout<<"from Fillng : hit parallel n. "<<i<<" con raggio conforme "<<RRR<<endl;
5798 
5799  for(j=nRdivConformalEffective-1, iR=0; j>0; j--){
5800  if( RRR> radiaConf[j] ){
5801  iR = j;
5802  break;
5803  }
5804  }
5805  if( nBoxConformal[iR][iFi] >= MAXHITSINCELL ){
5806  cout<<"Warning from PndSttTrackFinderReal::PndSttBoxConformalFilling :"
5807  <<"\n\tcontent in nBoxConformal["<<iR<<"]["<<iFi<<"] has reached the Max allowed value = "
5808  <<MAXHITSINCELL<<endl;
5809  continue;
5810  }
5811  HitsinBoxConformal[ nBoxConformal[iR][iFi] ][iR][iFi]=(Short_t) i;
5812  nBoxConformal[iR][iFi]++;
5813  RConformalIndex[ infoparal[i] ] = iR;
5814  FiConformalIndex[ infoparal[i] ] = iFi;
5815  } // end of for(i = 0; i< Nparal ; i++)
5816 
5817 
5818 
5819  return;
5820 
5821 }
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
static const Short_t MAXHITSINCELL
Double_t
static const Short_t nFidivConformal
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
Double_t radiaConf[nRdivConformal]
void PndSttTrackFinderReal::PndSttFindingParallelTrackAngularRange ( Double_t  oX,
Double_t  oY,
Double_t  r,
Short_t  Charge,
Double_t Fi_low_limit,
Double_t Fi_up_limit,
Short_t *  status,
Double_t  Rmin,
Double_t  Rmax 
)
private

Definition at line 10002 of file PndSttTrackFinderReal.cxx.

References a, acos(), atan2(), Double_t, fi, PI, and sqrt().

Referenced by FindTrackInXYProjection().

10021 {
10022 // The hits ALWAYS are contained between Fi_low_limit and Fi_up_limit;
10023 // the Point at (0,0) is NEVER contained between Fi_low_limit and Fi_up_limit.
10024 
10025 
10026 
10027 // -------------- calculate the maximum fi and minimum fi spanned by this track,
10028 
10029 // see logbook pag.270; by using the Rmin and Rmax of the straw detector.
10030 
10031 // working in the hypothesis that the starting point of the track is near (0,0) so that
10032 // R_vertex < RStrawDetectorMin
10033 
10034  bool intersection_inner,
10035  intersection_outer;
10036  Double_t teta1,
10037  teta2,
10038  tetavertex,
10039  a,
10040  cosT,
10041  cost,
10042  cosFi,
10043  cosfi,
10044  Fi,
10045  fi,
10046  FI0,
10047  Px,
10048  Py,
10049  tmp;
10050 
10051 
10052 // Rma += 1. ; // add a safety margin.
10053 // Rmi -= 1. ; // add a safety margin.
10054 
10055 
10056 
10057 
10058  a = sqrt(oX*oX+oY*oY);
10059 
10060  // preliminary condition
10061  if(a + R <= Rmi ) // in this case there might be hits at radius < Rmi.
10062  { *status = -1 ;return;}
10063  if( a >= R + Rma || R >= a + Rma) // in this case there can be no hits with radius < Rma.
10064  { *status = -2;return;}
10065 
10066  if( a - R >= Rmi ) intersection_inner = false; else intersection_inner = true;
10067 
10068  if( a + R <= Rma || a - R >= Rma )
10069  intersection_outer = false; else intersection_outer = true;
10070 
10071  if( (! intersection_inner) && (! intersection_outer) ){
10072  *Fi_low_limit = 0.;
10073  *Fi_up_limit = 2.*PI;
10074  *status = 1;
10075  return;
10076  }
10077 
10078 // now the calculation
10079 
10080  FI0 = atan2(-oY,-oX);
10081  if( intersection_outer ){
10082  cosFi = (a*a + R*R - Rma*Rma)/(2.*R*a);
10083  if(cosFi<-1.) cosFi=-1.; else if(cosFi>1.) cosFi=1.;
10084  Fi = acos(cosFi);
10085  }
10086 
10087  if( intersection_inner ){
10088  cosfi = (a*a + R*R - Rmi*Rmi)/(2.*R*a);
10089  if(cosfi<-1.) cosfi=-1.; else if(cosfi>1.) cosfi=1.;
10090  fi = acos(cosfi);
10091  }
10092 
10093 
10094  if( Charge < 0.){ // this particle rotates counterclockwise when looking into the beam
10095  if( intersection_outer && intersection_inner){
10096  *Fi_low_limit=FI0 + fi;
10097  *Fi_up_limit= FI0 +Fi;
10098 
10099  } else if (intersection_inner) {
10100  *Fi_low_limit=FI0 + fi;
10101  *Fi_up_limit= FI0 - fi;
10102  } else {
10103  *Fi_low_limit=FI0 - Fi;
10104  *Fi_up_limit= FI0 + Fi;
10105  } // end of if( intersection_outer && intersection_inner
10106 
10107 
10108 
10109  } else { // continuation of if( Charge < 0.)
10110 
10111  if( intersection_outer && intersection_inner){
10112  *Fi_low_limit=FI0 - Fi;
10113  *Fi_up_limit= FI0 - fi;
10114 
10115  } else if (intersection_inner) {
10116  *Fi_low_limit=FI0 + fi; // must invert because low limit must be < up limit
10117  *Fi_up_limit= FI0 - fi;
10118  } else {
10119  *Fi_low_limit=FI0 - Fi;
10120  *Fi_up_limit= FI0 + Fi;
10121  } // end of if( intersection_outer && intersection_inner
10122 
10123 
10124  } // end of if( Charge < 0.)
10125 
10126 
10127 
10128 
10129  if(*Fi_low_limit<0.) {
10130  *Fi_low_limit=fmod(*Fi_low_limit,2.*PI);
10131  *Fi_low_limit += 2.*PI;
10132  } else if (*Fi_low_limit>=2.*PI){
10133  *Fi_low_limit=fmod(*Fi_low_limit,2.*PI);
10134  }
10135  if(*Fi_up_limit<0.) {
10136  *Fi_up_limit=fmod(*Fi_up_limit,2.*PI);
10137  *Fi_up_limit += 2.*PI;
10138  } else if (*Fi_up_limit>=2.*PI){
10139  *Fi_up_limit=fmod(*Fi_up_limit,2.*PI);
10140  }
10141 
10142  // Modify *Fi_up_limit by adding
10143  // 2PI if it is the case, in order to make *Fi_up_limit > *Fi_low_limit.
10144  if( *Fi_up_limit < *Fi_low_limit ) *Fi_up_limit += 2.*PI;
10145  if( *Fi_up_limit < *Fi_low_limit ) *Fi_up_limit = *Fi_low_limit;
10146 
10147  *status = 0;
10148 
10149 
10150 
10151  return;
10152 }
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t a
Definition: anaLmdDigi.C:126
TFile * fi
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
Double_t R
Definition: checkhelixhit.C:61
int status[10]
Definition: f_Init.h:28
Short_t PndSttTrackFinderReal::PndSttFindTrackPatterninBoxConformal ( Short_t  NRCELLDISTANCE,
Short_t  NFiCELLDISTANCE,
Short_t  Nparal,
Short_t  ihit,
Short_t  nRcell,
Short_t  nFicell,
Double_t  info[][7],
bool  Exclusion_List[nmaxHits],
Short_t  RConformalIndex[nmaxHits],
Short_t  FiConformalIndex[nmaxHits],
Short_t  nBoxConformal[nRdivConformal][nFidivConformal],
Short_t  HitsinBoxConformal[][nRdivConformal][nFidivConformal],
Short_t *  ListHitsinTrack 
)
private

Definition at line 5933 of file PndSttTrackFinderReal.cxx.

References Double_t, i, infoparal, istampa, MINIMUMHITSPERTRACK, nFidivConformal, nmaxHits, nmaxHitsInTrack, nRdivConformalEffective, and status.

Referenced by FindTrackInXYProjection().

5948 {
5949 
5950  bool
5951  status,
5952  TemporaryInclusionList[nmaxHits];
5953 
5954  Short_t i;
5955  Short_t j,
5956  iFi,
5957  iR,
5958  nRmin,
5959  nRmax,
5960  nRemainingHits,
5961  nHitsinTrack,
5962  auxIndex[nmaxHits],
5963  Remaining[nmaxHits];
5964 
5965  Short_t iFi2;
5966 
5967  Double_t auxRvalues[nmaxHits];
5968 
5969 // ihit is the hit number in the PARALLEL number scheme
5970 
5971  for(i=0, nRemainingHits=0; i<Nparal; i++){
5972 
5973  if( i != ihit && InclusionList[ infoparal[i] ] ) { // Inclusion of the
5974  // parallel hit straws already used in other tracks
5975  // remember the index of InclusionList is in the
5976  // ORIGINAL scheme of hits
5977  TemporaryInclusionList[ infoparal[i] ]= true;
5978  Remaining[nRemainingHits]= i; // index of the PARALLEL hit
5979  nRemainingHits++;
5980  } else {
5981  TemporaryInclusionList[ infoparal[i] ]= false;
5982  }
5983  }
5984 
5985  if( nRemainingHits < MINIMUMHITSPERTRACK ) return 0;
5986 
5987 
5988 
5989 // cells of the seed hit
5990 
5991  if(ihit>=0){
5992  nHitsinTrack=1;
5993  ListHitsinTrack[0]= ihit ;
5994  i = 0;
5995  } else {
5996  nHitsinTrack=0;
5997  i = -1;
5998  }
5999 
6000  status=true;
6001  while( nRemainingHits > 0 && i < nHitsinTrack && status) {
6002 
6003 
6004  if (nRcell - NRCELLDISTANCE < 0 ) {
6005  nRmin = 0;
6006  } else {
6007  nRmin = nRcell - NRCELLDISTANCE;
6008  }
6009  if (nRcell + NRCELLDISTANCE >= nRdivConformalEffective ) {
6010  nRmax = nRdivConformalEffective-1;
6011  } else {
6012  nRmax = nRcell + NRCELLDISTANCE;
6013  }
6014 if(istampa>0) {cout<<"\tin FindTrackPatterninBoxConformal, nRmin = "<<nRmin
6015  <<", nRmax = "<<nRmax<<endl;
6016 cout<<"\tin FindTrackPatterninBoxConformal, nFicell = "<<nFicell<<endl;
6017 }
6018  for( iR= nRmin ; iR<= nRmax && status ; iR++){
6019  for(iFi2=nFicell-NFiCELLDISTANCE;iFi2<=nFicell+NFiCELLDISTANCE && status;iFi2++){
6020  if ( iFi2 < 0 ) {
6021  iFi = nFidivConformal + iFi2;
6022  } else if ( iFi2 >= nFidivConformal) {
6023  iFi = iFi2 - nFidivConformal;
6024  } else {
6025  iFi = iFi2;
6026  }
6027  for (j = 0; j< nBoxConformal[iR][iFi]; j++){
6028  if( InclusionList[ infoparal[ HitsinBoxConformal[j][iR][iFi] ] ]
6029  &&
6030  TemporaryInclusionList[infoparal[HitsinBoxConformal[j][iR][iFi]]]){
6031  // hit number in the PARALLEL straws scheme
6032  ListHitsinTrack[nHitsinTrack]=HitsinBoxConformal[j][iR][iFi] ;
6033  nHitsinTrack++;
6034  if( nHitsinTrack >= nmaxHitsInTrack){
6035  // finish the search
6036  status=false; // finish all outer loops as well.
6037  break ;
6038  }
6039  TemporaryInclusionList[infoparal[HitsinBoxConformal[j][iR][iFi]]]= false;
6040  nRemainingHits--;
6041  } // end of if( InclusionList[ infoparal[...
6042  }// end of for (j = 0; j< nBoxConformal[iR][iFi]; j++)
6043  } // end of for( iFi2 = nFicell - NFiCELLDISTANCE ;
6044  } // end of for( iR= nRmin ; iR<= nRmax ; iR++)
6045 //----------------
6046  i++;
6047  if(i<nmaxHitsInTrack){
6048  nRcell = RConformalIndex[ infoparal[ ListHitsinTrack[i] ] ];
6049  nFicell = FiConformalIndex[ infoparal[ ListHitsinTrack[i] ] ];
6050  }
6051  } // end while ( nRemainingHits > 0 && i < nHitsinTrack)
6052 
6053 
6054 
6055  return nHitsinTrack;
6056 
6057 }
Int_t i
Definition: run_full.C:25
Double_t
static const Short_t nFidivConformal
static const Short_t nmaxHits
static const Short_t nmaxHitsInTrack
int status[10]
Definition: f_Init.h:28
Short_t PndSttTrackFinderReal::PndSttFindTrackPatterninBoxConformalSpecial ( Short_t  NRCELLDISTANCE,
Short_t  NFiCELLDISTANCE,
Short_t  Nparal,
Short_t  NparallelToSearch,
Short_t  iSeed,
Short_t *  ListHitsinTrackinWhichToSearch,
Double_t  info[][7],
bool  InclusionList[nmaxHits],
Short_t  RConformalIndex[nmaxHits],
Short_t  FiConformalIndex[nmaxHits],
Short_t  nBoxConformal[nRdivConformal][nFidivConformal],
Short_t  HitsinBoxConformal[][nRdivConformal][nFidivConformal],
Short_t *  OutputListHitsinTrack 
)
private

Definition at line 6068 of file PndSttTrackFinderReal.cxx.

References Double_t, i, infoparal, MINIMUMHITSPERTRACK, nFidivConformal, nmaxHits, and nRdivConformalEffective.

Referenced by FindTrackInXYProjection().

6083 {
6084 
6085 
6086  bool TemporaryInclusionList[nmaxHits];
6087 
6088  Short_t i,
6089  i2,
6090  j,
6091  iFi,
6092  iR,
6093  nFicell,
6094  nHitsinTrack,
6095  nRcell,
6096  nRemainingHits,
6097  nRmax,
6098  nRmin,
6099  auxIndex[nmaxHits],
6100  Remaining[nmaxHits];
6101 
6102  Short_t iFi2;
6103 
6104  Double_t auxRvalues[nmaxHits];
6105 
6106 // iSeed is the hit number in the PARALLEL number scheme
6107 
6108 //-------- the following initialization is essential for the algorithm to work
6109  for(i=0; i<Nparal; i++){
6110  TemporaryInclusionList[ infoparal[i] ]= false;
6111  }
6112 //-------------
6113 
6114  for(i2=0, nRemainingHits=0; i2<NparallelToSearch; i2++){
6115  i=ListHitsinTrackinWhichToSearch[i2];
6116 // Inclusion of the parallel hit straws already used in other tracks;
6117 // remember the index of InclusionList is in the ORIGINAL scheme of hits.
6118  if( i != iSeed && InclusionList[ infoparal[i] ] ) {
6119  TemporaryInclusionList[ infoparal[i] ]= true;
6120  Remaining[nRemainingHits]= i; // index of the PARALLEL hit
6121  nRemainingHits++;
6122  }
6123  }
6124 
6125 
6126  if( nRemainingHits < MINIMUMHITSPERTRACK ) return 0;
6127 
6128 // cells of the seed hit
6129 
6130  nHitsinTrack=1;
6131  OutputListHitsinTrack[0]= iSeed ;
6132  i = 0;
6133  while( nRemainingHits > 0 && i < nHitsinTrack) {
6134 
6135  nRcell = RConformalIndex[ infoparal[ OutputListHitsinTrack[i] ] ];
6136  nFicell = FiConformalIndex[ infoparal[ OutputListHitsinTrack[i] ] ];
6137 
6138 //---------------
6139 
6140  if (nRcell - NRCELLDISTANCE < 0 ) {
6141  nRmin = 0;
6142  } else {
6143  nRmin = nRcell - NRCELLDISTANCE;
6144  }
6145  if (nRcell + NRCELLDISTANCE >= nRdivConformalEffective ) {
6146  nRmax = nRdivConformalEffective-1;
6147  } else {
6148  nRmax = nRcell + NRCELLDISTANCE;
6149  }
6150 
6151  for( iR= nRmin ; iR<= nRmax ; iR++){
6152  for( iFi2=nFicell-NFiCELLDISTANCE ; iFi2<=nFicell+NFiCELLDISTANCE;iFi2++){
6153  if ( iFi2 < 0 ) {
6154  iFi = nFidivConformal + iFi2;
6155  } else if ( iFi2 >= nFidivConformal) {
6156  iFi = iFi2 - nFidivConformal;
6157  } else {
6158  iFi = iFi2;
6159  }
6160  for (j = 0; j< nBoxConformal[iR][iFi]; j++){
6161  if( InclusionList[ infoparal[ HitsinBoxConformal[j][iR][iFi] ] ]
6162  &&
6163  TemporaryInclusionList[ infoparal[ HitsinBoxConformal[j][iR][iFi] ] ]) {
6164 // hit number in the PARALLEL straws scheme
6165  OutputListHitsinTrack[nHitsinTrack]=HitsinBoxConformal[j][iR][iFi] ;
6166  nHitsinTrack++;
6167  TemporaryInclusionList[infoparal[HitsinBoxConformal[j][iR][iFi]]]
6168  = false;
6169  nRemainingHits--;
6170  }
6171  } // end of for (j = 0; j< nBoxConformal[iR][iFi]; j++)
6172  }
6173  }
6174 //----------------
6175  i++;
6176 
6177  } // end while ( nRemainingHits > 0 && i < nHitsinTrack)
6178 
6179 
6180  return nHitsinTrack;
6181 
6182 }
Int_t i
Definition: run_full.C:25
Double_t
static const Short_t nFidivConformal
static const Short_t nmaxHits
Short_t PndSttTrackFinderReal::PndSttFindTrackStrictCollection ( Short_t  NFiCELLDISTANCE,
Short_t  iSeed,
Short_t  NParallelToSearch,
Short_t *  ListHitsinTrackinWhichToSearch,
bool  ExclusionList[nmaxHits],
Short_t  FiConformalIndex[nmaxHits],
Short_t *  OutputListHitsinTrack 
)
private

Definition at line 6195 of file PndSttTrackFinderReal.cxx.

References Double_t, i, infoparal, istampa, IVOLTE, nFidivConformal, nmassimo, and nmaxHits.

Referenced by FindTrackInXYProjection().

6204 {
6205 
6206 
6207 
6208 
6209 
6210 
6211  Short_t i, j, iR, iFi, iFiseed, nHitsinTrack;
6212 
6213 
6214  Double_t auxRvalues[nmaxHits];
6215 
6216 
6217 if(istampa>=3 && IVOLTE <= nmassimo) {
6218  cout<<"Da strictcollection, n. elementi delle search list "<<NParallelToSearch<<endl;
6219  for(i=0; i<NParallelToSearch; i++){
6220  cout<<"Da strictcollection, hit n. (parallel notation ) "<<ListHitsinTrackinWhichToSearch[i]<<endl;
6221  }
6222 }
6223 
6224 
6225 // iSeed is the hit number in the PARALLEL number scheme
6226 
6227  iFiseed = FiConformalIndex[ infoparal[ iSeed ] ];
6228 if(istampa>=3 && IVOLTE <= nmassimo)cout<<"Da strictcollection, iFiseed "<<iFiseed<<endl;
6229 
6230  nHitsinTrack=0;
6231  for(i=0; i<NParallelToSearch; i++){
6232  if( InclusionList[ infoparal[ ListHitsinTrackinWhichToSearch[i] ] ] ) { // Inclusion of the parallel hit straws already used in other tracks
6233  // remember the index of InclusionList is in the ORIGINAL scheme of hits
6234 
6235  iFi = FiConformalIndex[ infoparal[ ListHitsinTrackinWhichToSearch[i] ] ];
6236  if( iFi == iFiseed ) {
6237  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
6238  nHitsinTrack++;
6239  } else if ( iFi < iFiseed ) {
6240  if( iFiseed - iFi <= NFiCELLDISTANCE ) {
6241  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
6242  nHitsinTrack++;
6243  } else {
6244  if( iFi + nFidivConformal - iFiseed<= NFiCELLDISTANCE ) {
6245  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
6246  nHitsinTrack++;
6247  }
6248  }
6249  } else { // iFi > iFiseed
6250  if( -iFiseed + iFi <= NFiCELLDISTANCE ) {
6251  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
6252  nHitsinTrack++;
6253  } else {
6254  if( -iFi + nFidivConformal + iFiseed<= NFiCELLDISTANCE ) {
6255  OutputListHitsinTrack[nHitsinTrack]=ListHitsinTrackinWhichToSearch[i];
6256  nHitsinTrack++;
6257  }
6258  }
6259 
6260  } // end of if( iFi == iFiseed )
6261 
6262  } // end of if( InclusionList[ infoparal[ ListHitsinTrackinWhichToSearch[i] ] ] )
6263 
6264  } // end of for(i=0; i<NparallelToSearch; i++)
6265 
6266 
6267 if(istampa>=3 && IVOLTE <= nmassimo) {
6268  cout<<"Da strictcollection, n. elementi aggiunti "<<nHitsinTrack<<endl;
6269  for(i=0; i<nHitsinTrack; i++){
6270  cout<<"Da strictcollection, hit n. (parallel notaion ) "<<OutputListHitsinTrack[i]<<endl;
6271  }
6272 }
6273 
6274  return nHitsinTrack;
6275 
6276 }
Int_t i
Definition: run_full.C:25
Double_t
static const Short_t nFidivConformal
static const Short_t nmaxHits
Short_t PndSttTrackFinderReal::PndSttFitSZspacebis ( Short_t  nSttSkewhitinTrack,
Double_t S,
Double_t Z,
Double_t DriftRadius,
Double_t  FInot,
Short_t  NMAX,
Double_t m 
)
private

Definition at line 9079 of file PndSttTrackFinderReal.cxx.

References angle, Double_t, fabs(), i, nmaxHits, status, and STRAWRADIUS.

9088 {
9089 
9090  // definition of variables for the glpsol solver
9091  // ROWS (for read_rows function)
9092  //
9093  Short_t NpointsInFit = nSttSkewhitinTrack-NMAX <0 ? nSttSkewhitinTrack : NMAX;
9094  int nRows= NpointsInFit*9 +1;
9095  int typeRows[nRows];
9096  char * nameRows[nRows];
9097  char auxnameRows[nRows][20];
9098 //------- end ROWS information
9099 //--------begin COLUMNS information
9100  int NStructVar=5+NpointsInFit*4; // number of structural variables
9101  int NStructRows = 8*NpointsInFit ; // maximum number of ROWS in which a structural variable can be found
9102  double final_values[NStructVar];
9103  int NRowsInWhichStructVarArePresent[NStructVar];
9104  char *StructVarName[NStructVar];
9105  char auxStructVarName[NStructVar][20];
9106  char *NameRowsInWhichStructVarArePresent[NStructVar*NStructRows];
9107  char aux[NStructVar*NStructRows][20];
9108 // double Coefficients[NStructVar][NStructRows];
9109  double Coefficients[NStructVar*NStructRows];
9110 //--------end COLUMNS information
9111 //--------begin RHS information
9112  double ValueB[9*NpointsInFit];
9113 //--------end RHS information
9114 //--------begin RANGES information
9115  int nRanges = NpointsInFit;
9116  double ValueRanges[nRanges];
9117  char *NameRanges[nRanges];
9118  char auxNameRanges[nRanges][20];
9119 //--------end RANGES information
9120 //--------start BOUNDS information
9121  int nBounds=2*NpointsInFit+3;
9122 // int nBounds=2*NpointsInFit+1;
9123  double BoundValue[nBounds];
9124  char *BoundStructVarName[nBounds];
9125  char auxBoundStructVarName[nBounds][20];
9126  char *TypeofBound[nBounds];
9127  char auxTypeofBound[nBounds][20];
9128 //--------end BOUNDS information
9129 
9130 
9131 //----------------------------------------------------
9132 
9133 
9134 
9135 
9136 
9137 
9138 
9139  Double_t M = 50.,
9140  m_result,
9141  q_result,
9142  A,
9143  alfetta,
9144  angle,
9145  offsety,
9146  Ox[nmaxHits],
9147  Oy[nmaxHits],
9148  Delta[nmaxHits];
9149 
9150  Short_t i, ii;
9151  Short_t Status;
9152 
9153  char nome[300], stringa[300], stringa2[300];
9154 
9155 // FILE * MACRO ;
9156 
9157  float m1_result,m2_result, q1_result,q2_result, A1_result, A2_result;
9158 
9159 // --
9160 
9161 
9162 
9163 // rotation of 90 degrees
9164 
9165  for(i=0;i<nSttSkewhitinTrack; i++){
9166 
9167 
9168  Ox[i] = S[ i ] - FInot;
9169  Oy[i] = -Z[ i ];
9170 
9171  Delta[i] = 3.*STRAWRADIUS; // STRAWRADIUS now is 0.5 cm
9172 
9173  }
9174 
9175 //----------------- write the ROWS section
9176 
9177 //--------
9178  sprintf(&auxnameRows[0][0],"OBJECT");
9179  nameRows[0]=&auxnameRows[0][0];
9180  typeRows[0]=GLP_FR;
9181  for(i=0 ; i< NpointsInFit ; i++) {
9182  ii=9*i;
9183  typeRows[1+ii]=GLP_UP;typeRows[2+ii]=GLP_UP;typeRows[3+ii]=GLP_UP;typeRows[4+ii]=GLP_UP;
9184  typeRows[5+ii]=GLP_UP;typeRows[6+ii]=GLP_UP;typeRows[7+ii]=GLP_UP;typeRows[8+ii]=GLP_UP;
9185  typeRows[9+ii]=GLP_LO;
9186 
9187  sprintf(&(auxnameRows[1+ii][0]),"Ap%d",i); nameRows[1+ii]=&auxnameRows[1+ii][0];
9188  sprintf(&(auxnameRows[2+ii][0]),"Bp%d",i); nameRows[2+ii]=&auxnameRows[2+ii][0];
9189  sprintf(&(auxnameRows[3+ii][0]),"Cp%d",i); nameRows[3+ii]=&auxnameRows[3+ii][0];
9190  sprintf(&(auxnameRows[4+ii][0]),"Dp%d",i); nameRows[4+ii]=&auxnameRows[4+ii][0];
9191  sprintf(&(auxnameRows[5+ii][0]),"Am%d",i); nameRows[5+ii]=&auxnameRows[5+ii][0];
9192  sprintf(&(auxnameRows[6+ii][0]),"Bm%d",i); nameRows[6+ii]=&auxnameRows[6+ii][0];
9193  sprintf(&(auxnameRows[7+ii][0]),"Cm%d",i); nameRows[7+ii]=&auxnameRows[7+ii][0];
9194  sprintf(&(auxnameRows[8+ii][0]),"Dm%d",i); nameRows[8+ii]=&auxnameRows[8+ii][0];
9195  sprintf(&(auxnameRows[9+ii][0]),"LAMBDA%d",i); nameRows[9+ii]=&auxnameRows[9+ii][0];
9196  }
9197 
9198 
9199 
9200 
9201 
9202 //----------------- write the COLUMNS section
9203 
9204 
9205 // Column variable m1
9206  for(i=0, ii=0 ; i< NpointsInFit ; i++) {
9207  ii++;
9208  Coefficients[i*4]= Ox[i];
9209  Coefficients[i*4+1]= Ox[i];
9210  Coefficients[i*4+2]= -Ox[i];
9211  Coefficients[i*4+3]= -Ox[i];
9212  }
9213 
9214 // Column variable m2
9215  for(i=0; i< NpointsInFit ; i++) {
9216  Coefficients[NStructRows+i*4]= -Ox[i];
9217  Coefficients[NStructRows+i*4+1]= -Ox[i];
9218  Coefficients[NStructRows+i*4+2]= Ox[i];
9219  Coefficients[NStructRows+i*4+3]= Ox[i];
9220 
9221  }
9222 
9223 // Column variable q1
9224  for(i=0 ; i< NpointsInFit ; i++) {
9225  Coefficients[2*NStructRows+i*4]= 1.;
9226  Coefficients[2*NStructRows+i*4+1]= 1.;
9227  Coefficients[2*NStructRows+i*4+2]= -1.;
9228  Coefficients[2*NStructRows+i*4+3]= -1.;
9229  }
9230 
9231 // Column variable q2
9232  for(i=0 ; i< NpointsInFit ; i++) {
9233  Coefficients[3*NStructRows+i*4]= -1.;
9234  Coefficients[3*NStructRows+i*4+1]= -1.;
9235  Coefficients[3*NStructRows+i*4+2]= 1.;
9236  Coefficients[3*NStructRows+i*4+3]= 1.;
9237  }
9238 
9239 // Column variable lambdap(i)
9240  for(i=0 ; i< NpointsInFit ; i++) {
9241  Coefficients[(4+i)*NStructRows+0]= -M;
9242  Coefficients[(4+i)*NStructRows+1]= -M;
9243  Coefficients[(4+i)*NStructRows+2]= -M;
9244  Coefficients[(4+i)*NStructRows+3]= M;
9245  Coefficients[(4+i)*NStructRows+4]= 1.;
9246  }
9247 // Column variable lambdam(i)
9248  for(i=0 ; i< NpointsInFit ; i++) {
9249  Coefficients[(4+i+NpointsInFit)*NStructRows+0]= -M;
9250  Coefficients[(4+i+NpointsInFit)*NStructRows+1]= -M;
9251  Coefficients[(4+i+NpointsInFit)*NStructRows+2]= -M;
9252  Coefficients[(4+i+NpointsInFit)*NStructRows+3]= M;
9253  Coefficients[(4+i+NpointsInFit)*NStructRows+4]= 1.;
9254  }
9255 // Column variable sigmap(i)
9256  for(i=0; i< NpointsInFit ; i++) {
9257 
9258  Coefficients[(4+i+2*NpointsInFit)*NStructRows+0]= 1./Delta[i];
9259  Coefficients[(4+i+2*NpointsInFit)*NStructRows+1]= -1.;
9260  Coefficients[(4+i+2*NpointsInFit)*NStructRows+2]= -1.;
9261  Coefficients[(4+i+2*NpointsInFit)*NStructRows+3]= 1.;
9262  Coefficients[(4+i+2*NpointsInFit)*NStructRows+4]= -1.;
9263  }
9264 // Column variable sigmam(i)
9265  for(i=0 ; i< NpointsInFit ; i++) {
9266  Coefficients[(4+i+3*NpointsInFit)*NStructRows+0]= 1./Delta[i];
9267  Coefficients[(4+i+3*NpointsInFit)*NStructRows+1]= -1.;
9268  Coefficients[(4+i+3*NpointsInFit)*NStructRows+2]= -1.;
9269  Coefficients[(4+i+3*NpointsInFit)*NStructRows+3]= 1.;
9270  Coefficients[(4+i+3*NpointsInFit)*NStructRows+4]= -1.;
9271  }
9272 
9273 // Column variable DUMMY
9274  for(i=0 ; i< NStructRows ; i++) {
9275  Coefficients[(4+4*NpointsInFit)*NStructRows+i]= 1.;
9276  }
9277 //--------------------
9278  sprintf(&auxStructVarName[0][0],"m1");
9279  StructVarName[0] = &auxStructVarName[0][0];
9280  NRowsInWhichStructVarArePresent[0]= 4*NpointsInFit;
9281 
9282  sprintf(&auxStructVarName[1][0],"m2");
9283  StructVarName[1] = &auxStructVarName[1][0];
9284  NRowsInWhichStructVarArePresent[1]= 4*NpointsInFit;
9285 
9286  sprintf(&auxStructVarName[2][0],"q1");
9287  StructVarName[2] = &auxStructVarName[2][0];
9288  NRowsInWhichStructVarArePresent[2]= 4*NpointsInFit;
9289 
9290  sprintf(&auxStructVarName[3][0],"q2");
9291  StructVarName[3] = &auxStructVarName[3][0];
9292  NRowsInWhichStructVarArePresent[3]= 4*NpointsInFit;
9293  for(i=0; i< NpointsInFit ; i++) {
9294  sprintf(&auxStructVarName[3+i+1][0],"lamp%d",i);
9295  StructVarName[4+i] = &auxStructVarName[4+i][0];
9296  NRowsInWhichStructVarArePresent[4+i]= 5;
9297 
9298  sprintf(&auxStructVarName[4+NpointsInFit+i][0],"lamm%d",i);
9299  StructVarName[4+NpointsInFit+i] = &auxStructVarName[4+NpointsInFit+i][0];
9300  NRowsInWhichStructVarArePresent[4+NpointsInFit+i]= 5;
9301 
9302  sprintf(&auxStructVarName[4+2*NpointsInFit+i][0],"sigmap%d",i);
9303  StructVarName[4+2*NpointsInFit+i] = &auxStructVarName[4+2*NpointsInFit+i][0];
9304  NRowsInWhichStructVarArePresent[4+2*NpointsInFit+i]= 5;
9305 
9306  sprintf(&auxStructVarName[4+3*NpointsInFit+i][0],"sigmam%d",i);
9307  StructVarName[4+3*NpointsInFit+i] = &auxStructVarName[4+3*NpointsInFit+i][0];
9308  NRowsInWhichStructVarArePresent[4+3*NpointsInFit+i]= 5;
9309 
9310  }
9311  sprintf(&auxStructVarName[4+4*NpointsInFit][0],"DUMMY");
9312  StructVarName[4+4*NpointsInFit] = &auxStructVarName[4+4*NpointsInFit][0];
9313  NRowsInWhichStructVarArePresent[4+4*NpointsInFit]= NStructRows;
9314 // for m1, m2, q1, q2
9315  for(i=0; i< 4; i++){
9316  for(ii=0; ii< NpointsInFit;ii++){
9317  sprintf(&aux[i*NStructRows+ii*4][0],"Ap%d",ii);
9318  NameRowsInWhichStructVarArePresent[i*NStructRows+ii*4]=&aux[i*NStructRows+ii*4][0];
9319  sprintf(&aux[i*NStructRows+ii*4+1][0],"Am%d",ii);
9320  NameRowsInWhichStructVarArePresent[i*NStructRows+ii*4+1]=&aux[i*NStructRows+ii*4+1][0];
9321  sprintf(&aux[i*NStructRows+ii*4+2][0],"Bp%d",ii);
9322  NameRowsInWhichStructVarArePresent[i*NStructRows+ii*4+2]=&aux[i*NStructRows+ii*4+2][0];
9323  sprintf(&aux[i*NStructRows+ii*4+3][0],"Bm%d",ii);
9324  NameRowsInWhichStructVarArePresent[i*NStructRows+ii*4+3]=&aux[i*NStructRows+ii*4+3][0];
9325  }
9326  }
9327 
9328 // now for the lamp* variables
9329  for(i=0; i< NpointsInFit;i++){
9330  sprintf(&aux[(i+4)*NStructRows+0][0],"Ap%d",i);
9331  NameRowsInWhichStructVarArePresent[(i+4)*NStructRows+0]= &aux[(i+4)*NStructRows+0][0];
9332  sprintf(&aux[(i+4)*NStructRows+1][0],"Bp%d",i);
9333  NameRowsInWhichStructVarArePresent[(i+4)*NStructRows+1]= &aux[(i+4)*NStructRows+1][0];
9334  sprintf(&aux[(i+4)*NStructRows+2][0],"Cp%d",i);
9335  NameRowsInWhichStructVarArePresent[(i+4)*NStructRows+2]= &aux[(i+4)*NStructRows+2][0];
9336  sprintf(&aux[(i+4)*NStructRows+3][0],"Dp%d",i);
9337  NameRowsInWhichStructVarArePresent[(i+4)*NStructRows+3]= &aux[(i+4)*NStructRows+3][0];
9338  sprintf(&aux[(i+4)*NStructRows+4][0],"LAMBDA%d",i);
9339  NameRowsInWhichStructVarArePresent[(i+4)*NStructRows+4]= &aux[(i+4)*NStructRows+4][0];
9340  }
9341 
9342 // now for the lamm* variables
9343  for(i=0; i< NpointsInFit;i++){
9344  sprintf(&aux[(i+4+NpointsInFit)*NStructRows+0][0],"Am%d",i);
9345  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit)*NStructRows+0]= &aux[(i+4+NpointsInFit)*NStructRows+0][0];
9346  sprintf(&aux[(i+4+NpointsInFit)*NStructRows+1][0],"Bm%d",i);
9347  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit)*NStructRows+1]= &aux[(i+4+NpointsInFit)*NStructRows+1][0];
9348  sprintf(&aux[(i+4+NpointsInFit)*NStructRows+2][0],"Cm%d",i);
9349  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit)*NStructRows+2]= &aux[(i+4+NpointsInFit)*NStructRows+2][0];
9350  sprintf(&aux[(i+4+NpointsInFit)*NStructRows+3][0],"Dm%d",i);
9351  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit)*NStructRows+3]= &aux[(i+4+NpointsInFit)*NStructRows+3][0];
9352  sprintf(&aux[(i+4+NpointsInFit)*NStructRows+4][0],"LAMBDA%d",i);
9353  NameRowsInWhichStructVarArePresent[(i+4+NpointsInFit)*NStructRows+4]= &aux[(i+4+NpointsInFit)*NStructRows+4][0];
9354  }
9355 
9356 // now for the sigmap* variables
9357  for(i=0; i< NpointsInFit;i++){
9358 // sprintf(&aux[(i+4+2*NpointsInFit)*NStructRows+0][0],"OBJECT",i);
9359  sprintf(&aux[(i+4+2*NpointsInFit)*NStructRows+0][0],"OBJECT");
9360  NameRowsInWhichStructVarArePresent[(i+4+2*NpointsInFit)*NStructRows+0]= &aux[(i+4+2*NpointsInFit)*NStructRows+0][0];
9361  sprintf(&aux[(i+4+2*NpointsInFit)*NStructRows+1][0],"Ap%d",i);
9362  NameRowsInWhichStructVarArePresent[(i+4+2*NpointsInFit)*NStructRows+1]= &aux[(i+4+2*NpointsInFit)*NStructRows+1][0];
9363  sprintf(&aux[(i+4+2*NpointsInFit)*NStructRows+2][0],"Bp%d",i);
9364  NameRowsInWhichStructVarArePresent[(i+4+2*NpointsInFit)*NStructRows+2]= &aux[(i+4+2*NpointsInFit)*NStructRows+2][0];
9365  sprintf(&aux[(i+4+2*NpointsInFit)*NStructRows+3][0],"Cp%d",i);
9366  NameRowsInWhichStructVarArePresent[(i+4+2*NpointsInFit)*NStructRows+3]= &aux[(i+4+2*NpointsInFit)*NStructRows+3][0];
9367  sprintf(&aux[(i+4+2*NpointsInFit)*NStructRows+4][0],"Dp%d",i);
9368  NameRowsInWhichStructVarArePresent[(i+4+2*NpointsInFit)*NStructRows+4]= &aux[(i+4+2*NpointsInFit)*NStructRows+4][0];
9369  }
9370 
9371 // now for the sigmam* variables
9372  for(i=0; i< NpointsInFit;i++){
9373 // sprintf(&aux[(i+4+3*NpointsInFit)*NStructRows+0][0],"OBJECT",i);
9374  sprintf(&aux[(i+4+3*NpointsInFit)*NStructRows+0][0],"OBJECT");
9375  NameRowsInWhichStructVarArePresent[(i+4+3*NpointsInFit)*NStructRows+0]= &aux[(i+4+3*NpointsInFit)*NStructRows+0][0];
9376  sprintf(&aux[(i+4+3*NpointsInFit)*NStructRows+1][0],"Am%d",i);
9377  NameRowsInWhichStructVarArePresent[(i+4+3*NpointsInFit)*NStructRows+1]= &aux[(i+4+3*NpointsInFit)*NStructRows+1][0];
9378  sprintf(&aux[(i+4+3*NpointsInFit)*NStructRows+2][0],"Bm%d",i);
9379  NameRowsInWhichStructVarArePresent[(i+4+3*NpointsInFit)*NStructRows+2]= &aux[(i+4+3*NpointsInFit)*NStructRows+2][0];
9380  sprintf(&aux[(i+4+3*NpointsInFit)*NStructRows+3][0],"Cm%d",i);
9381  NameRowsInWhichStructVarArePresent[(i+4+3*NpointsInFit)*NStructRows+3]= &aux[(i+4+3*NpointsInFit)*NStructRows+3][0];
9382  sprintf(&aux[(i+4+3*NpointsInFit)*NStructRows+4][0],"Dm%d",i);
9383  NameRowsInWhichStructVarArePresent[(i+4+3*NpointsInFit)*NStructRows+4]= &aux[(i+4+3*NpointsInFit)*NStructRows+4][0];
9384  }
9385 
9386 // now for the DUMMY variable
9387  for(i=0; i< NpointsInFit;i++){
9388  sprintf(&aux[(4+4*NpointsInFit)*NStructRows +8*i][0],"Ap%d",i);
9389  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+i*8 ]= &aux[(4+4*NpointsInFit)*NStructRows +8*i][0];
9390 
9391  sprintf(&aux[(4+4*NpointsInFit)*NStructRows+1+8*i][0],"Am%d",i);
9392  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+1+8*i]= &aux[(4+4*NpointsInFit)*NStructRows+1+8*i][0];
9393  sprintf(&aux[(4+4*NpointsInFit)*NStructRows+2+8*i][0],"Bp%d",i);
9394  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+2+8*i]= &aux[(4+4*NpointsInFit)*NStructRows+2+8*i][0];
9395  sprintf(&aux[(4+4*NpointsInFit)*NStructRows+3+8*i][0],"Bm%d",i);
9396  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+3+8*i]= &aux[(4+4*NpointsInFit)*NStructRows+3+8*i][0];
9397  sprintf(&aux[(4+4*NpointsInFit)*NStructRows+4+8*i][0],"Cp%d",i);
9398  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+4+8*i]= &aux[(4+4*NpointsInFit)*NStructRows+4+8*i][0];
9399  sprintf(&aux[(4+4*NpointsInFit)*NStructRows+5+8*i][0],"Cm%d",i);
9400  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+5+8*i]= &aux[(4+4*NpointsInFit)*NStructRows+5+8*i][0];
9401  sprintf(&aux[(4+4*NpointsInFit)*NStructRows+6+8*i][0],"Dp%d",i);
9402  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+6+8*i]= &aux[(4+4*NpointsInFit)*NStructRows+6+8*i][0];
9403  sprintf(&aux[(4+4*NpointsInFit)*NStructRows+7+8*i][0],"Dm%d",i);
9404  NameRowsInWhichStructVarArePresent[(4+4*NpointsInFit)*NStructRows+7+8*i]= &aux[(4+4*NpointsInFit)*NStructRows+7+8*i][0];
9405  }
9406 
9407 //----------------- write the RHS section
9408 
9409  for(i=0 ; i< NpointsInFit ; i++) {
9410  ValueB[i*9] = Oy[i]+DriftRadius[ i ]+2.*M;
9411  ValueB[i*9+1]= -Oy[i]-DriftRadius[ i ]+2.*M;
9412  ValueB[i*9+2]= Delta[i]+2.*M;
9413  ValueB[i*9+3]= M-Delta[i]+2.*M;
9414  ValueB[i*9+4]= Oy[i]-DriftRadius[ i ]+2.*M;
9415  ValueB[i*9+5]= -Oy[i]+DriftRadius[ i ]+2.*M;
9416  ValueB[i*9+6]= Delta[i]+2.*M;
9417  ValueB[i*9+7]= M-Delta[i]+2.*M;
9418  ValueB[i*9+8]= 1.;
9419 
9420 
9421  }
9422 
9423 
9424 //----------------- write the RANGES section
9425 
9426  for(i=0 ; i< NpointsInFit ; i++) {
9427  ValueRanges[i]=1.;
9428  sprintf(&auxNameRanges[i][0],"LAMBDA%d",i);
9429  NameRanges[i]=&auxNameRanges[i][0];
9430  }
9431 
9432 //----------------- write the BOUNDS section
9433 
9434 
9435  for(i=0 ; i< NpointsInFit ; i++) {
9436  sprintf(&auxTypeofBound[i][0],"BV");
9437  TypeofBound[i]=&auxTypeofBound[i][0];
9438  sprintf(&auxBoundStructVarName[i][0],"lamp%d",i);
9439  BoundStructVarName[i]=&auxBoundStructVarName[i][0];
9440  BoundValue[i]=0.;
9441  }
9442 
9443  for(i=0 ; i< NpointsInFit ; i++) {
9444  sprintf(&auxTypeofBound[i+NpointsInFit][0],"BV");
9445  TypeofBound[i+NpointsInFit]=&auxTypeofBound[i+NpointsInFit][0];
9446  sprintf(&auxBoundStructVarName[i+NpointsInFit][0],"lamm%d",i);
9447  BoundStructVarName[i+NpointsInFit]=&auxBoundStructVarName[i+NpointsInFit][0];
9448  BoundValue[i+NpointsInFit]=0.;
9449  }
9450 
9451  sprintf(&auxTypeofBound[2*NpointsInFit][0],"FX");
9452  TypeofBound[2*NpointsInFit]=&auxTypeofBound[2*NpointsInFit][0];
9453  sprintf(&auxBoundStructVarName[2*NpointsInFit][0],"DUMMY");
9454  BoundStructVarName[2*NpointsInFit]=&auxBoundStructVarName[2*NpointsInFit][0];
9455  BoundValue[2*NpointsInFit]=2.*M;
9456 
9457 
9458 
9459 // fixing q1
9460  sprintf(&auxTypeofBound[2*NpointsInFit+1][0],"FX");
9461  TypeofBound[2*NpointsInFit+1]=&auxTypeofBound[2*NpointsInFit+1][0];
9462  sprintf(&auxBoundStructVarName[2*NpointsInFit+1][0],"q1");
9463  BoundStructVarName[2*NpointsInFit+1]=&auxBoundStructVarName[2*NpointsInFit+1][0];
9464  BoundValue[2*NpointsInFit+1]= 0.;
9465 // fixing q2
9466  sprintf(&auxTypeofBound[2*NpointsInFit+2][0],"FX");
9467  TypeofBound[2*NpointsInFit+2]=&auxTypeofBound[2*NpointsInFit+2][0];
9468  sprintf(&auxBoundStructVarName[2*NpointsInFit+2][0],"q2");
9469  BoundStructVarName[2*NpointsInFit+2]=&auxBoundStructVarName[2*NpointsInFit+2][0];
9470  BoundValue[2*NpointsInFit+2]= 0.;
9471 
9472 //-----
9473 
9474 
9475 
9476 
9477 
9478 
9479 //---------------------- calling the minimizer
9480 
9481 // WHEN THE FIT WENT WELL, STATUS = 0
9482 
9483  int status= glp_main(
9484  nRows,nameRows,typeRows, // ROWS info
9485  NStructVar, NStructRows, NRowsInWhichStructVarArePresent, // COLUMNS info
9486  StructVarName, NameRowsInWhichStructVarArePresent, // COLUMNS info
9487  Coefficients, // COLUMNS info
9488  ValueB, // RHS info
9489  nRanges, ValueRanges, NameRanges, // RANGES info
9490  nBounds, BoundValue, BoundStructVarName, TypeofBound // BOUNDS info
9491 // ,final_values, TIMEOUT // timeout is in seconds.
9492  ,final_values
9493  );
9494 
9495  if (status != 0) return -100;
9496 
9497 //------------------------------------------
9498 
9499  m1_result=final_values[0];
9500  m2_result=final_values[1];
9501 // q1_result=final_values[2];
9502 // q2_result=final_values[3];
9503 
9504 //------------------------ transformation of the result in terms of ALFA, BETA, GAMMA
9505 
9506 
9507 
9508 
9509 
9510 // taking into account the rotation + traslation that was performed and calculate emme and qu
9511 
9512  *emme = m1_result-m2_result ;
9513 // *qu = FInot;
9514 
9515  if(fabs( (*emme) )> 1.e-10) {
9516  *emme=-1./(*emme);
9517  return 1;
9518  } else {
9519 
9520  return -99;
9521  }
9522 
9523 
9524 
9525 
9526 
9527 }
Int_t i
Definition: run_full.C:25
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
static const Double_t STRAWRADIUS
double Z
Definition: anaLmdDigi.C:68
Double_t angle
int status[10]
Definition: f_Init.h:28
void PndSttTrackFinderReal::PndSttFromXYtoConformal ( Double_t  trajectory_vertex[3],
Double_t  info[][7],
Int_t  Nparal,
Double_t  infoparalConformal[][5],
Int_t *  status 
)
private

Definition at line 5645 of file PndSttTrackFinderReal.cxx.

References Double_t, fabs(), i, infoparal, r, STRAWRADIUS, x, and y.

Referenced by DoFind().

5652 {
5653 
5654 
5655 // do the transformation in the conformal space : u= x/(x**2+y**2), v= y/(x**2+y**2) for each hit from parallel
5656 // straws; also the equidrift radius changes.
5657 
5658 //
5659 
5660  Double_t gamma, x, y, r;
5661 
5662  for(int i=0; i<Nparal; i++){
5663  x = info[infoparal[i]][0]-trajectory_vertex[0];
5664  y = info[infoparal[i]][1]-trajectory_vertex[1];
5665  r = info[infoparal[i]][3];
5666  gamma = x*x + y*y - r*r;
5667  if(fabs( gamma ) < 1.e-10) {
5668  *status = -1;
5669  continue;
5670  }
5671  infoparalConformal[i][0] = x / gamma;
5672  infoparalConformal[i][1] = y / gamma;
5673  infoparalConformal[i][2] = r/fabs(gamma);
5674  infoparalConformal[i][3] = infoparal[i] ; // n. of the Hit (in the original order)
5675  infoparalConformal[i][4] = STRAWRADIUS/fabs(gamma);
5676 
5677  }
5678 
5679 
5680  *status=0;
5681  return;
5682 }
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Double_t STRAWRADIUS
Double_t x
Double_t y
int status[10]
Definition: f_Init.h:28
void PndSttTrackFinderReal::PndSttFromXYtoConformal2 ( Double_t  trajectory_vertex[3],
Short_t  nHitsinTrack,
Short_t  iExclude,
Short_t *  ListHits,
Double_t  info[][7],
Double_t  auxinfoparalConformal[][5],
Int_t *  status 
)
private

Definition at line 5696 of file PndSttTrackFinderReal.cxx.

References Double_t, fabs(), i, infoparal, r, STRAWRADIUS, x, and y.

5705 {
5706 
5707 
5708 // do the transformation in the conformal space : u= x/(x**2+y**2), v= y/(x**2+y**2) for each hit from parallel
5709 // straws; also the equidrift radius changes.
5710 
5711 //
5712 
5713  Double_t gamma, x, y, r;
5714 
5715  for(int i=0; i<nHitsinTrack; i++){
5716  if( i == iExclude) continue;
5717  x = info[ infoparal[ListHits[i]] ][0]-trajectory_vertex[0];
5718  y = info[ infoparal[ListHits[i]] ][1]-trajectory_vertex[1];
5719  r = info[ infoparal[ListHits[i]] ][3];
5720  gamma = x*x + y*y - r*r;
5721  if(fabs( gamma ) < 1.e-10) {
5722  *status = -1;
5723  continue;
5724  }
5725  auxinfoparalConformal[i][0] = x / gamma;
5726  auxinfoparalConformal[i][1] = y / gamma;
5727  auxinfoparalConformal[i][2] = r/fabs(gamma);
5728  auxinfoparalConformal[i][3] = infoparal[ListHits[i]] ; // n. of the Hit (in the original order)
5729  auxinfoparalConformal[i][4] = STRAWRADIUS/fabs(gamma);
5730 
5731 
5732  }
5733 
5734 
5735 
5736  *status=0;
5737  return;
5738 }
double r
Definition: RiemannTest.C:14
Int_t i
Definition: run_full.C:25
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Double_t STRAWRADIUS
Double_t x
Double_t y
int status[10]
Definition: f_Init.h:28
void PndSttTrackFinderReal::PndSttInfoXYZParal ( Double_t  info[][7],
Short_t  infopar,
Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  KAPPA,
Double_t  FI0,
Short_t  Charge,
Double_t Posiz 
)
private

Definition at line 10952 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, fabs(), fi, PI, and sqrt().

Referenced by DoFind().

10963 {
10964 
10965 
10966 // Posiz = position (on the drift radius) of the hit whose 'parallel' scheme
10967 // number is infopar.
10968 
10969 
10970 
10971  Double_t fi, norm, vers[2];
10972 
10973  vers[0] = Ox - info[infopar][0];
10974  vers[1] = Oy - info[infopar][1];
10975  norm = sqrt( vers[0]*vers[0] + vers[1]*vers[1] );
10976 
10977  if(norm < 1.e-20) {
10978  Posiz[0] = -999999999.;
10979  return;
10980  }
10981 
10982 
10983  if( fabs( R - fabs( norm - info[infopar][3] ) ) // distance trajectory-drift radius
10984  <
10985  fabs( R - (norm + info[infopar][3]) ) ) {
10986 
10987  Posiz[0] = info[infopar][0] + info[infopar][3]*vers[0]/norm;
10988  Posiz[1] = info[infopar][1] + info[infopar][3]*vers[1]/norm;
10989 
10990  } else {
10991 
10992  Posiz[0] = info[infopar][0] - info[infopar][3]*vers[0]/norm;
10993  Posiz[1] = info[infopar][1] - info[infopar][3]*vers[1]/norm;
10994 
10995  } // end of if ( fabs( R - fabs( Distance - info[infopar][3] ) ).....
10996 
10997 
10998 
10999 
11000 // Posiz[0] = info[infopar][0] + info[infopar][3]*vers[0]/norm;
11001 // Posiz[1] = info[infopar][1] + info[infopar][3]*vers[1]/norm;
11002 
11003  if( fabs(KAPPA)<1.e-10 ){
11004  Posiz[2] = -888888888.;
11005  return;
11006  } else if ( fabs(KAPPA) > 1.e10){
11007  Posiz[2] = -777777777.;
11008  return;
11009  }
11010 
11011 
11012  fi = atan2(-vers[1],-vers[0]);
11013  if(fi<0.) fi += 2.*PI;
11014 
11015  if ( Charge > 0){
11016  if(fi > FI0 ) FI0 += 2.*PI;
11017 // Posiz[2] = (FI0-fi)/KAPPA;
11018  } else {
11019  if(fi < FI0 ) fi += 2.*PI;
11020  }
11021  Posiz[2] = (fi-FI0)/KAPPA;
11022 
11023  return;
11024 }
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
TFile * fi
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
Double_t R
Definition: checkhelixhit.C:61
void PndSttTrackFinderReal::PndSttInfoXYZSkew ( Double_t  Z,
Double_t  ZDrift,
Double_t  S,
Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  KAPPA,
Double_t  FI0,
Short_t  Charge,
Double_t Posiz 
)
private

Definition at line 11041 of file PndSttTrackFinderReal.cxx.

References cos(), Double_t, fabs(), istampa, PI, sign(), and sin().

Referenced by DoFind().

11053 {
11054  Short_t sign;
11055 
11056  Double_t bbb,
11057  tempZ[2],
11058  zmin, zmax, deltaz,
11059  zdist[2],
11060  zdist1,
11061  zdist2;
11062 
11063 
11064 
11065  Double_t Zline;
11066 
11067  if(fabs(KAPPA)< 1.e-10) {
11068  Posiz[0] = -999999999.;
11069  return;
11070  } else if (fabs(KAPPA)> 1.e10) {
11071  Posiz[0] = -888888888.;
11072  return;
11073  }
11074 
11075  Posiz[0] = Ox + R * cos(S);
11076  Posiz[1] = Oy + R * sin(S);
11077 
11078  if( Charge > 0 ) {
11079  if( S > FI0 ) {
11080  if(istampa>=3){ cout<<"from PndSttInfoXYZSkew : inconsistency, FI0 is not the maximum for this track "<<endl;
11081 cout<<" stampa da PndSttInfoXYZSkew, "<<", Z hit = "<<Z<<", Zrift = "<<ZDrift<<", S = "<<S<<", FI0 = "<<FI0<<endl;
11082 }
11083  Posiz[0] = -777777777.;
11084  return;
11085  }
11086  } else {
11087  if( S < FI0 ) {
11088  if(istampa>=3) {cout<<"from PndSttInfoXYZSkew : inconsistency, FI0 is not the minimum for this track "<<endl;
11089 cout<<" stampa da PndSttInfoXYZSkew, "<<", Z hit = "<<Z<<", Zrift = "<<ZDrift<<", S = "<<S<<", FI0 = "<<FI0<<endl;
11090 }
11091  Posiz[0] = -777777777.;
11092  return;
11093  }
11094  }
11095 
11096 
11097 
11098 
11099 
11100 
11101 
11102  if(KAPPA>0) {
11103  zmin = -FI0/KAPPA;
11104  zmax = (2.*PI-FI0)/KAPPA;
11105  } else {
11106  zmax = -FI0/KAPPA;
11107  zmin = (2.*PI-FI0)/KAPPA;
11108  }
11109  deltaz = zmax-zmin;
11110 
11111 
11112  bbb=(S-FI0)/KAPPA;
11113  for(sign=0;sign<=1; sign ++){
11114  tempZ[sign]=Z+(2*sign-1)*ZDrift;
11115  if( tempZ[sign] > zmax ){
11116  tempZ[sign]=fmod( tempZ[sign]-zmax, deltaz) + zmin;
11117  } else if (tempZ[sign]<zmin){
11118  tempZ[sign]=fmod( tempZ[sign]-zmin, deltaz) + zmax;
11119  }
11120 
11121 
11122  zdist1 = fabs( bbb - tempZ[sign]);
11123  zdist2 = deltaz- zdist1;
11124  if( zdist2<0.) zdist2 =0.; // protect against rounding errors.
11125  zdist[sign] = zdist1 < zdist2 ? zdist1 : zdist2;
11126 
11127 
11128 
11129  } // end of for(sign=0;sign<=1; sign++)
11130 
11131 
11132  zdist[0] < zdist[1] ? Posiz[2] = Z - ZDrift : Posiz[2] = Z + ZDrift ;
11133 
11134 
11135 
11136 
11137  return;
11138 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Double_t PI
double Z
Definition: anaLmdDigi.C:68
int sign(T val)
Definition: PndCADef.h:48
Double_t R
Definition: checkhelixhit.C:61
void PndSttTrackFinderReal::PndSttOrdering ( Double_t  oX,
Double_t  oY,
Double_t  info[][7],
Short_t  nParallelHits,
Short_t *  ListParallelHits,
Short_t  nSttSkewhit,
Short_t *  ListSkewHits,
Double_t S,
Short_t *  Infoparal,
Short_t *  Infoskew,
Short_t *  nTotal,
Short_t *  BigList,
Short_t *  Charge 
)
private

Definition at line 9890 of file PndSttTrackFinderReal.cxx.

References atan2(), Double_t, fabs(), i, Merge_Sort(), nmaxHits, nSttSkewhit, and PI.

9905 {
9906 
9907  *nTotal = nParallelHits+nSttSkewhit;
9908 
9909  Short_t i,j,flag,
9910  aux[*nTotal];
9911  Double_t old,
9912  auxFivalues[nmaxHits],
9913  auxFiSkewvalues[nmaxHits],
9914  auxRvalues[nmaxHits],
9915  BigListFi[*nTotal];
9916 
9917 
9918 
9919 // here there is the ordering of the hits
9920 
9921 // ordering of the parallel hits is not necessary; already done previously in
9922 // PndSttOrderingParallel, also taking care of the Charge (when positive, the
9923 // ordering must be reversed).
9924 
9925 
9926 
9927  for (j = 0; j< nParallelHits; j++){
9928  auxFivalues[j] = atan2( info[ Infoparal[ ListParallelHits[j] ] ][1]-oY,
9929  info[ Infoparal[ ListParallelHits[j] ] ][0]-oX);
9930  if( auxFivalues[j] < 0. ) auxFivalues[j] += 2.*PI;
9931 
9932  }
9933 
9934 // fixing possible discontinuity between fi<2*PI and fi>0.
9935  for (old=auxFivalues[0],flag=0, j = 1; j< nParallelHits; j++){
9936  if( fabs(old - auxFivalues[j]) > PI ) {
9937  flag=1;
9938  break;
9939  } else {
9940  old=auxFivalues[j];
9941  }
9942  }
9943  if( flag==1) {
9944  for (j = 0; j< nParallelHits; j++){
9945  if( auxFivalues[j] < PI) auxFivalues[j] += 2.*PI;
9946  }
9947  }
9948 
9949 // now ordering of the skew hits
9950  if(nSkewHit>0){
9951  if( flag==1) {
9952  for (j = 0; j< nSkewHit; j++){
9953  if( S[Infoskew[ ListSkewHits[j] ]] < PI) {
9954  auxFiSkewvalues[j] = S[Infoskew[ ListSkewHits[j] ]] + 2.*PI;
9955  } else {
9956  auxFiSkewvalues[j] = S[Infoskew[ ListSkewHits[j] ]];
9957  }
9958  }
9959  } else {
9960  for (j = 0; j< nSkewHit; j++){
9961  auxFiSkewvalues[j] = S[Infoskew[ ListSkewHits[j] ]];
9962  }
9963  }
9964 
9965  Merge_Sort( nSkewHit, auxFiSkewvalues, ListSkewHits);
9966  } // end of if(nSkewHit>0)
9967 
9968 // merge the parallel and skew hits
9969  for(j = 0;j< nParallelHits; j++){
9970  BigListFi[j]=auxFivalues[j];
9971  BigList[j] = Infoparal[ ListParallelHits[j] ] ;
9972  }
9973  for(j=0; j<nSkewHit; j++){
9974  BigListFi[j+nParallelHits]=auxFiSkewvalues[j];
9975  BigList [j+nParallelHits] = Infoskew[ ListSkewHits[j] ] ;
9976  }
9977 
9978  if(nSkewHit>0) Merge_Sort(*nTotal, BigListFi, BigList);
9979 
9980 
9981 //--------- end ordering
9982 
9983 
9984 
9985  return;
9986 
9987 }
Int_t i
Definition: run_full.C:25
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
void PndSttTrackFinderReal::PndSttOrderingParallel ( Double_t  oX,
Double_t  oY,
Double_t  info[][7],
Short_t  nParallelHits,
Short_t *  ListParallelHits,
Short_t *  Infoparal,
Short_t  Charge,
Double_t Fi_initial_helix_referenceframe,
Double_t Fi_final_helix_referenceframe,
Double_t U,
Double_t V 
)
private

Definition at line 9537 of file PndSttTrackFinderReal.cxx.

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

Referenced by FindTrackInXYProjection().

9550 {
9551 
9552 
9553 
9554 
9555  Short_t i,j,
9556  tmp[nParallelHits];
9557  Double_t aaa,
9558  b1,
9559  firstR2,
9560  lastR2,
9561  aux[nParallelHits];
9562 
9563 
9564 
9565 // here there is the ordering of the hits, under the assumption that the circumference
9566 // in XY goes through (0,0).
9567 // Moreover, the code before is supposed to have selected trajectories in XY with (Ox,Oy)
9568 // farther from (0,0) by > 0.9 * RminStrawDetector/2 and consequently Ox and Oy are not both 0.
9569 // The scheme for the ordering of the hit is as follows :
9570 // 1) order hits by increasing U or V of the conformal mapping; see Gianluigi's Logbook page 283;
9571 // 2) find the charge of the track by checking if it is closest to the center in XY
9572 // the first or the last of the ordered hits.
9573 // 3) in case, invert the ordering of U, V and ListParallelHits such that the first hits in the
9574 // list are alway those closer to the (0,0).
9575 
9576 
9577 // ordering of the hits
9578 
9579  aaa = atan2( oY, oX); // atan2 defined between -PI and PI.
9580 
9581  // the following statement is necessary since for unknown reason the root interpreter
9582  // gives a weird error when using PI directly in the if statement below!!!!!!! I lost
9583  // 2 hours trying to figure this out!
9584  b1 = PI/4.;
9585 
9586  if((aaa>b1&&aaa<3.*b1) || (aaa>-3.*b1&&aaa<-b1)){//use U as ordering variable;
9587  //[case 1 or 3 Gianluigi's Logbook page 285].
9588  for (j = 0; j< nParallelHits; j++){
9589  U[j]=info[ Infoparal[ ListParallelHits[j] ] ][0]/(
9590  info[ Infoparal[ ListParallelHits[j] ] ][0]*
9591  info[ Infoparal[ ListParallelHits[j] ] ][0]+
9592  info[ Infoparal[ ListParallelHits[j] ] ][1]*
9593  info[ Infoparal[ ListParallelHits[j] ] ][1]);
9594  }
9595  Merge_Sort( nParallelHits, U, ListParallelHits);
9596 
9597  if((aaa>b1&&aaa<3.*b1)){ // case #1;
9598  if( Charge == -1){
9599  // inverting the order of the hits.
9600  for(i=0;i<nParallelHits;i++){
9601  tmp[i]=ListParallelHits[nParallelHits-1-i];
9602  aux[i] = U[nParallelHits-1-i];
9603  }
9604  for(i=0;i<nParallelHits;i++){
9605  ListParallelHits[i]=tmp[i];
9606  U[i] = aux[i];
9607  }
9608  }
9609  for (j = 0; j< nParallelHits; j++){
9610  V[j]=info[ Infoparal[ ListParallelHits[j] ] ][1]/(
9611  info[ Infoparal[ ListParallelHits[j] ] ][0]*
9612  info[ Infoparal[ ListParallelHits[j] ] ][0]+
9613  info[ Infoparal[ ListParallelHits[j] ] ][1]*
9614  info[ Infoparal[ ListParallelHits[j] ] ][1]);
9615  }
9616  } else{ // case # 3.
9617  if(Charge == 1){
9618  // inverting the order of the hits.
9619  for(i=0;i<nParallelHits;i++){
9620  tmp[i]=ListParallelHits[nParallelHits-1-i];
9621  aux[i] = U[nParallelHits-1-i];
9622  }
9623  for(i=0;i<nParallelHits;i++){
9624  ListParallelHits[i]=tmp[i];
9625  U[i] = aux[i];
9626  }
9627  }// end of if( Charge ==1)
9628  for (j = 0; j< nParallelHits; j++){
9629  V[j]=info[ Infoparal[ ListParallelHits[j] ] ][1]/(
9630  info[ Infoparal[ ListParallelHits[j] ] ][0]*
9631  info[ Infoparal[ ListParallelHits[j] ] ][0]+
9632  info[ Infoparal[ ListParallelHits[j] ] ][1]*
9633  info[ Infoparal[ ListParallelHits[j] ] ][1]);
9634  }
9635  }// end of if((aaa>b1&&aaa<3.*b1))
9636 
9637  } else { // use V as ordering variable [case 2 or 4 Gianluigi's Logbook page 285].
9638  for (j = 0; j< nParallelHits; j++){
9639  V[j]=info[ Infoparal[ ListParallelHits[j] ] ][1]/(
9640  info[ Infoparal[ ListParallelHits[j] ] ][0]*
9641  info[ Infoparal[ ListParallelHits[j] ] ][0]+
9642  info[ Infoparal[ ListParallelHits[j] ] ][1]*
9643  info[ Infoparal[ ListParallelHits[j] ] ][1]);
9644  }
9645  Merge_Sort( nParallelHits, V, ListParallelHits);
9646 
9647  if((aaa<=-3.*b1 || aaa>=3.*b1)){ // case #2;
9648  if( Charge == -1){
9649  // inverting the order of the hits.
9650  for(i=0;i<nParallelHits;i++){
9651  tmp[i]=ListParallelHits[nParallelHits-1-i];
9652  aux[i] = V[nParallelHits-1-i];
9653  }
9654  for(i=0;i<nParallelHits;i++){
9655  ListParallelHits[i]=tmp[i];
9656  V[i] = aux[i];
9657  }
9658  }
9659  for (j = 0; j< nParallelHits; j++){
9660  U[j]=info[ Infoparal[ ListParallelHits[j] ] ][0]/(
9661  info[ Infoparal[ ListParallelHits[j] ] ][0]*
9662  info[ Infoparal[ ListParallelHits[j] ] ][0]+
9663  info[ Infoparal[ ListParallelHits[j] ] ][1]*
9664  info[ Infoparal[ ListParallelHits[j] ] ][1]);
9665  }
9666  } else{ // case # 4.
9667  if( Charge == 1){
9668  // inverting the order of the hits.
9669  for(i=0;i<nParallelHits;i++){
9670  tmp[i]=ListParallelHits[nParallelHits-1-i];
9671  aux[i] = V[nParallelHits-1-i];
9672  }
9673  for(i=0;i<nParallelHits;i++){
9674  ListParallelHits[i]=tmp[i];
9675  V[i] = aux[i];
9676  }
9677  }
9678  for (j = 0; j< nParallelHits; j++){
9679  U[j]=info[ Infoparal[ ListParallelHits[j] ] ][0]/(
9680  info[ Infoparal[ ListParallelHits[j] ] ][0]*
9681  info[ Infoparal[ ListParallelHits[j] ] ][0]+
9682  info[ Infoparal[ ListParallelHits[j] ] ][1]*
9683  info[ Infoparal[ ListParallelHits[j] ] ][1]);
9684  }
9685  }
9686 
9687  } // end of if((aaa>b1&& ....
9688 
9689 
9690 
9691 
9692 
9693 
9694 // FI initial value (at 0,0 vertex) in the Helix reference frame
9695 
9696  *Fi_initial_helix_referenceframe = atan2(-oY,-oX) ;// this is in order to be coherent
9697  // with the calculatation of Fi, which is atan2(oY,oX).
9698  // atan2 is defined in [-PI,PI)
9699  if ( *Fi_initial_helix_referenceframe <0.)
9700  *Fi_initial_helix_referenceframe += 2.*PI;
9701 
9702 // FI of the last parallel hit in the Helix reference frame
9703 
9704  *Fi_final_helix_referenceframe = atan2(
9705  info[ Infoparal[ ListParallelHits[nParallelHits-1] ] ][1]-oY,
9706  info[ Infoparal[ ListParallelHits[nParallelHits-1] ] ][0]-oX
9707  );
9708  if ( *Fi_final_helix_referenceframe <0.)
9709  *Fi_final_helix_referenceframe += 2.*PI;
9710 
9711  if ( Charge > 0 ) {
9712  if( *Fi_final_helix_referenceframe> *Fi_initial_helix_referenceframe)
9713  *Fi_final_helix_referenceframe -= 2.*PI;
9714  if( *Fi_final_helix_referenceframe> *Fi_initial_helix_referenceframe)
9715  *Fi_final_helix_referenceframe = *Fi_initial_helix_referenceframe;
9716  } else {
9717  if( *Fi_final_helix_referenceframe< *Fi_initial_helix_referenceframe)
9718  *Fi_final_helix_referenceframe += 2.*PI;
9719  if( *Fi_final_helix_referenceframe< *Fi_initial_helix_referenceframe)
9720  *Fi_final_helix_referenceframe = *Fi_initial_helix_referenceframe;
9721  }
9722 
9723 
9724 
9725 
9726  return;
9727 
9728 
9729 }
Int_t i
Definition: run_full.C:25
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
void PndSttTrackFinderReal::PndSttOrderingSkewandParallel ( Short_t *  Infoparal,
Short_t *  Infoskew,
Double_t  oX,
Double_t  oY,
Double_t  Rr,
Short_t  nSttSkewhit,
Short_t *  ListSkewHits,
Double_t SList,
Short_t  Charge,
Short_t  nParHits,
Short_t *  ListParHits,
Double_t U,
Double_t V,
Short_t *  BigList 
)
private

Definition at line 9739 of file PndSttTrackFinderReal.cxx.

References atan2(), b1, cos(), Double_t, i, Merge_Sort(), PI, sign(), and sin().

Referenced by DoFind().

9758 {
9759 
9760 
9761  Short_t i,j,
9762  index[nSkewhit+nParHits],
9763  tmp[nSkewhit+nParHits],
9764  tmpList[nSkewhit];
9765  Double_t aaa,
9766  b1,
9767  sign,
9768  aux[nSkewhit+nParHits];
9769 
9770 
9771 
9772 // here there is the ordering of the hits, under the assumption that the circumference
9773 // in XY goes through (0,0).
9774 // Moreover, the code before is supposed to have selected trajectories in XY with (Ox,Oy)
9775 // farther from (0,0) by > 0.9 * RminStrawDetector/2 and consequently Ox and Oy are not both 0.
9776 // The scheme for the ordering of the hit is as follows :
9777 // 1) order hits by increasing U of the conformal mapping; see Gianluigi's Logbook page 283;
9778 // 2) find the charge of the track by checking if it is closest to the center in XY
9779 // the first or the last of the ordered hits.
9780 
9781 
9782 
9783 // ordering of the hits
9784 
9785  aaa = atan2( oY, oX); // atan2 defined between -PI and PI.
9786 
9787  // the following statement is necessary since for unknown reason the root interpreter
9788  // gives a weird error when using PI directly in the if statement below!!!!!!! I lost
9789  // 2 hours trying to figure this out!
9790  b1 = PI/4.;
9791 
9792 
9793  if(aaa>b1&&aaa<3.*b1|| (aaa>-3.*b1&&aaa<-b1)){ // case #1 or #3;see Gianluigi's Logbook page 285.
9794  if( (aaa>b1&&aaa<3.*b1 && Charge == -1)||( aaa>-3.*b1&&aaa<-b1 && Charge == 1) )
9795  { // for speeding up the ordering taking advantage
9796  // that the parallel hits were earlier ordered and
9797  // apply the trick of multiplying by -1.
9798  sign=-1.;
9799  } else { // normal calculation
9800  sign=1.;
9801  }
9802 
9803  for (j = 0 ; j< nParHits; j++){
9804  aux[j] = sign*U[j];
9805 // BigList[j]=Infoparal[ListParHits[j]];
9806 // index[j] = j;
9807  }
9808  for (j = 0; j< nSkewhit; j++){
9809  // this is U in conformal space
9810  aux[j+nParHits]=sign*(oX + Rr*cos(SList[Infoskew[ListSkewHits[j]]]))/
9811  (oX*oX+oY*oY+Rr*Rr + 2.*Rr*
9812  (oX*cos(SList[Infoskew[ListSkewHits[j]]])
9813  +oY*sin(SList[Infoskew[ListSkewHits[j]]])));
9814 // BigList[j+nParHits]=Infoskew[ListSkewHits[j]];
9815 // index[j+nParHits] = j+nParHits;
9816  }
9817 
9818 
9819  } else { // use V as ordering variable
9820  // [case 2 and 4 Gianluigi's Logbook page 285].
9821 
9822  if( ((aaa<=-3.*b1|| aaa>=3.*b1) && Charge == -1)
9823  || ( -b1 <= aaa && aaa <= b1 && Charge == 1) ){
9824  sign=-1.;
9825  } else {
9826  sign=1.;
9827  }
9828  for (j = 0 ; j< nParHits; j++){
9829  aux[j] = sign*V[j];
9830 // BigList[j]=Infoparal[ListParHits[j]];
9831 // index[j] = j;
9832  }
9833  for (j = 0; j< nSkewhit; j++){
9834  // this is V in conformal space.
9835  aux[j+nParHits]=sign*(oY + Rr*sin(SList[Infoskew[ListSkewHits[j]]]))/
9836  (oX*oX+oY*oY+Rr*Rr + 2.*Rr*
9837  (oX*cos(SList[Infoskew[ListSkewHits[j]]])
9838  +oY*sin(SList[Infoskew[ListSkewHits[j]]])));
9839 // BigList[j+nParHits]=Infoskew[ListSkewHits[j]];
9840 // index[j+nParHits] = j+nParHits;
9841  }
9842 
9843 
9844  } // end of if((aaa>b1&& ....
9845 
9846 
9847  for (j = 0 ; j< nParHits; j++){
9848  BigList[j]=Infoparal[ListParHits[j]];
9849  index[j] = j;
9850  }
9851  for (j = 0; j< nSkewhit; j++){
9852  BigList[j+nParHits]=Infoskew[ListSkewHits[j]];
9853  index[j+nParHits] = j+nParHits;
9854  }
9855 
9856  Merge_Sort( nSkewhit+nParHits, aux, index);
9857 
9858 
9859  for(i=0, j=0;i<nSkewhit+nParHits;i++){
9860  tmp[i]=BigList[index[i]];
9861  // reorder the ListSkewHits also.
9862  if( index[i] >= nParHits ){
9863  tmpList[j] = ListSkewHits[index[i]-nParHits];
9864  j++;
9865  }
9866  }
9867  for(i=0;i<nSkewhit+nParHits;i++){
9868  BigList[i]= tmp[i];
9869  }
9870  // reorder the ListSkewHits also.
9871  for(i=0;i<nSkewhit;i++){
9872  ListSkewHits[i]= tmpList[i];
9873  }
9874 
9875 
9876  return;
9877 
9878 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
Int_t i
Definition: run_full.C:25
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void Merge_Sort(Short_t n_ele, Double_t *array, Short_t *ind)
int sign(T val)
Definition: PndCADef.h:48
Short_t PndSttTrackFinderReal::PndSttTrkAssociatedParallelHitsToHelix ( Double_t  Ox,
Double_t  Oy,
Double_t  R,
Int_t  Nhits,
Double_t  info[][7],
Short_t *  auxListHitsinTrack 
)
private

Definition at line 2858 of file PndSttTrackFinderReal.cxx.

References Double_t, dx, dy, fabs(), i, infoparal, sqrt(), and STRAWRADIUS.

2866 {
2867 
2868  Int_t i;
2869  Short_t Nassociatedhits;
2870 
2871  Double_t dx, dy,distance;
2872 
2873 
2874 // Ox = (D+R)*cos(Fi);
2875 // Oy = (D+R)*sin(Fi);
2876 
2877 
2878 
2879 // association of hits in the XY plane
2880 
2881  Nassociatedhits=0;
2882 
2883  for( i=0; i< Nhits; i++) {
2884 
2885 
2886 // Kincl = (int) info[i][5] - 1;
2887 
2888 // -------------------- association of the hits from parallel straws
2889 // if( info[i][5] == 1. ) { // parallel straws
2890 
2891  dx = -Ox+info[ infoparal[i] ][0];
2892  dy = -Oy+info[ infoparal[i] ][1];
2893  distance = sqrt(dx*dx+dy*dy);
2894 //cout<<"nuov, R "<<R<<", distance "<<distance<<endl;
2895 // if( distance < 1.e-10) continue;
2896 // angle = atan2(dy,dx);
2897 
2898  if ( fabs(R - distance ) > 2.*STRAWRADIUS ) continue;
2899  auxListHitsinTrack[Nassociatedhits]=i;
2900  Nassociatedhits++;
2901 
2902 // } // end of if( info[i][5] == 1 ) else
2903 
2904 
2905  } // end of for( i=1; i< Nhits; i++)
2906 
2907 
2908 
2909 
2910 
2911 
2912  return Nassociatedhits;
2913 
2914 }
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
double dx
static const Double_t STRAWRADIUS
Double_t R
Definition: checkhelixhit.C:61
Short_t PndSttTrackFinderReal::PndSttTrkAssociatedParallelHitsToHelix5 ( bool  ExclusionList[nmaxHits],
Int_t  NhitsParallel,
Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  info[][7],
Double_t  Fi_low,
Double_t  Fi_up,
Short_t *  auxListHitsinTrack 
)
private

Definition at line 6761 of file PndSttTrackFinderReal.cxx.

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

Referenced by FindTrackInXYProjection().

6772 {
6773 
6774  Short_t i;
6775 
6776  Short_t nAssociatedHits;
6777 
6778  Double_t angle,
6779  dx,
6780  dy,
6781  distance,
6782  NTIMES=5.; // number of Straw radia allowed in association.
6783 
6784  nAssociatedHits=0;
6785 // find the Hits belonging to this Track.
6786 
6787 
6788 
6789  for(i=0; i<NhitsParallel;i++){
6790  if( !InclusionList[ infoparal[i] ] ) continue;
6791 // check if the hit position is near the circle of the Helix found by the fit
6792 
6793 
6794 
6795 
6796 
6797  dx = -Ox+info[ infoparal[i] ][0];
6798  dy = -Oy+info[ infoparal[i] ][1];
6799  angle=atan2(dy,dx);
6800  if(angle<0.) angle += 2.*PI;
6801  if(angle<0.) angle =0.;
6802  distance = sqrt(dx*dx+dy*dy);
6803  if ( fabs(R - distance ) > NTIMES*STRAWRADIUS ) continue;
6804  if(angle<Fi_low) angle += 2.*PI;
6805  if(angle>Fi_up) continue;
6806  auxListHitsinTrack[nAssociatedHits]= i;
6807  nAssociatedHits++;
6808  } // end for(i=0; i<NhitsParallel;i++)
6809 
6810  return nAssociatedHits;
6811 
6812 }
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t
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
static const Double_t PI
static const Double_t STRAWRADIUS
Double_t angle
Double_t R
Definition: checkhelixhit.C:61
Short_t PndSttTrackFinderReal::PndSttTrkAssociatedParallelHitsToHelixQuater ( bool  ExclusionList[nmaxHits],
Double_t  m,
Double_t  q,
Short_t  Status,
Short_t  nHitsinTrack,
Short_t *  ListHitsinTrack,
Int_t  NhitsParallel,
Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  info[][7],
Double_t  infoparalConformal[][5],
Short_t *  RConformalIndex,
Short_t *  FiConformalIndex,
Short_t  nBoxConformal[nRdivConformal][nFidivConformal],
Short_t  HitsinBoxConformal[][nRdivConformal][nFidivConformal],
Short_t *  auxListHitsinTrack 
)
private

Definition at line 6289 of file PndSttTrackFinderReal.cxx.

References angle, atan2(), cos(), DELTAnR, Double_t, dx, dy, fabs(), i, istampa, nFidivConformal, nmaxHits, nRdivConformal, nRdivConformalEffective, PI, PndSttAcceptHitsConformal(), r, radiaConf, RStrawDetectorMin, sin(), sqrt(), and STRAWRADIUS.

Referenced by FindTrackInXYProjection().

6308 {
6309  bool passamin,passamax,
6310  Unselected[nmaxHits];
6311 
6312  Short_t i, i2, j, k, l, l2, l3, itemp, kstart, kend,
6313  iFi0,FFimin, FFimax;
6314  Short_t Nextra=8,
6315  nFi,
6316  Fi,
6317  nR,
6318  nAssociatedHits,
6319  nHit_original;
6320  Double_t maxFi,
6321  minFi,
6322  dist,
6323  xx,
6324  yy,
6325  aaa,
6326  angle,
6327  r,
6328  erre1,
6329  erre2,
6330  Rin,
6331  Rout,
6332  Fi0,
6333  ddd,
6334  fi1,
6335  fi2,
6336  dx,
6337  dy,
6338  distance,
6339  NTIMES=1.5; // number of Straw radia allowed in association
6340 
6341  nAssociatedHits=0;
6342  for(i=0; i<NhitsParallel;i++){
6343  Unselected[i]= true;
6344  }
6345 
6346 // find the range in Fi spanned by the candidate track
6347 
6348  FFimin = 10000;
6349  FFimax = 0;
6350  for(j=0; j<nHitsinTrack; j++){
6351  i = (Short_t) infoparalConformal[ ListHitsinTrack[j] ][3];
6352 
6353 
6354  if( FiConformalIndex[i] < FFimin ) FFimin = FiConformalIndex[i];
6355  if( FiConformalIndex[i] > FFimax ) FFimax = FiConformalIndex[i];
6356  }
6357 
6358 
6359  if( FFimax > 3.*nFidivConformal/4. && FFimin < nFidivConformal/4.) {
6360  FFimin = 10000;
6361  FFimax = 0;
6362  for(j=0; j<nHitsinTrack; j++){
6363  i = (Short_t) infoparalConformal[ ListHitsinTrack[j] ][3];
6364  Fi = FiConformalIndex[i];
6365  if( Fi < nFidivConformal/4. ) Fi = FiConformalIndex[i]+nFidivConformal;
6366  if( Fi < FFimin ) FFimin = Fi;
6367  if( Fi > FFimax ) FFimax = Fi;
6368  }
6369  }
6370 
6371 
6372 // finding the boundaries in the Conformal plane. The basic assumption is that the range
6373 // in Fi is much less that 180 degrees.
6374 
6375  FFimin -= (Short_t) nFidivConformal/Nextra;
6376  FFimax += (Short_t) nFidivConformal/Nextra;
6377 if( FFimax - FFimin > nFidivConformal/2 ) {
6378  cout<<"something fishy is going on in PndSttTrkAssociatedParallelHitsToHelixQuater!"
6379  <<"Range in Fi (rad) is "<<(FFimax - FFimin)*2.*PI/nFidivConformal<<endl;
6380  return 0;
6381 }
6382 
6383 
6384 
6385 // use the equation of a line in polar coordinates
6386 
6387  if( Status ==99) { // case in which 0 = x + q
6388 
6389  if(fabs(q) > 1.e-10 ) {
6390  passamax=false;
6391  passamin=false;
6392  for(itemp=FFimin; itemp<=FFimax;itemp++){
6393  i=itemp;
6394  if( i< 0 ) {
6395  i += nFidivConformal;
6396  } else if (i>=nFidivConformal){
6397  i -= nFidivConformal*( i/nFidivConformal );
6398 // i -= nFidivConformal;
6399  }
6400  angle = (i+0.5)*2.*PI/nFidivConformal;
6401  aaa = cos(angle);
6402  if( fabs(cos(angle)) <1.e-10) continue;
6403  r = -q/aaa;
6404  if(r< radiaConf[0] || r>= 1./RStrawDetectorMin) continue;
6405  for(j=nRdivConformalEffective-1; j>=0;j--){
6406  if( r>= radiaConf[j] ){
6407  nR = j;
6408  break;
6409  }
6410  }
6411 
6412 
6413  for(l=-DELTAnR; l<DELTAnR+1;l++){
6414  l2 = nR+l;
6415  if( l2<0 || l2 >= nRdivConformalEffective ) continue;
6416  for( k=0;k<nBoxConformal[l2][i];k++){
6417  nHit_original = (Short_t) infoparalConformal[ HitsinBoxConformal[k][l2][i] ][3];
6418  if( !InclusionList[ nHit_original ] ) continue;
6419 // check if the hit position is near the circle of the Helix found by the fit
6420  dx = -Ox+info[ nHit_original ][0];
6421  dy = -Oy+info[ nHit_original ][1];
6422  distance = sqrt(dx*dx+dy*dy);
6423 //cout<<"nuov, R "<<R<<", distance "<<distance<<endl;
6424  if ( fabs(R - distance ) > NTIMES*STRAWRADIUS ) continue;
6425 
6426 //-------------------
6427  xx=infoparalConformal[ HitsinBoxConformal[k][l2][i] ][0];
6428  dist = fabs( xx +q );
6429  if( PndSttAcceptHitsConformal( dist,
6430  infoparalConformal[ HitsinBoxConformal[k][l2][i] ][2],
6431  infoparalConformal[ HitsinBoxConformal[k][l2][i] ][4]
6432  ) ) {
6433  auxListHitsinTrack[nAssociatedHits]= HitsinBoxConformal[k][l2][i];
6434  nAssociatedHits++;
6435  }
6436  } // end of for( k=0;k<nBoxConformal[l2][i];k++)
6437  } // end of for(l=-DELTAnR; l<DELTAnR+1;l++)
6438 
6439  // ------- special cases
6440  if((nR == nRdivConformalEffective-1 && passamin && ! passamax) || (nR==0 && passamax && !passamin) ) { // do the last two Fi columns
6441  if(nR == nRdivConformalEffective-1) passamax=true;
6442  if(nR == 0) passamin=true;
6443 
6444  for(l2=1;l2<3;l2++){
6445  i2 = i+l2;
6446  if(i2>=nFidivConformal) i2 -= nFidivConformal;
6447  for(l=-2; l<3;l++){
6448  l3 = nR+l;
6449  if( l3<0 || l3 >= nRdivConformalEffective ) continue;
6450  for( k=0;k<nBoxConformal[l3][i2];k++){
6451  nHit_original = (Short_t) infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][3];
6452  if( !InclusionList[ nHit_original ] ) continue;
6453 // check if the hit position is near the circle of the Helix found by the fit
6454  dx = -Ox+info[ nHit_original ][0];
6455  dy = -Oy+info[ nHit_original ][1];
6456  distance = sqrt(dx*dx+dy*dy);
6457  if ( fabs(R - distance ) > NTIMES*STRAWRADIUS ) continue;
6458 
6459 //-------------------
6460  xx=infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][0];
6461  dist = fabs( xx +q );
6462 // if(dist < 3.*infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][2]){
6463  if( PndSttAcceptHitsConformal( dist,
6464  infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][2],
6465  infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][4]
6466  ) ) {
6467  auxListHitsinTrack[nAssociatedHits]= HitsinBoxConformal[k][l3][i2];
6468  nAssociatedHits++;
6469  }
6470  } // end of for( k=0;k<nBoxConformal[l3][i2];k++)
6471  } // end of for(l=-2; l<3;l++)
6472  } // end of for(l2=0;l2<2;l2++)
6473  return nAssociatedHits;
6474  } else if ((nR == nRdivConformalEffective-1 && ! passamin && !passamax) || (nR==0 && !passamax && !passamin)){
6475  if(nR == nRdivConformalEffective-1) passamax=true;
6476  if(nR == 0) passamin=true;
6477 
6478  for(l2=1;l2<3;l2++){
6479  i2 = i-l2;
6480  if(i2<nFidivConformal) i2 += nFidivConformal;
6481  for(l=-2; l<3;l++){
6482  l3 = nR+l;
6483  if( l3<0 || l3 >= nRdivConformalEffective ) continue;
6484  for( k=0;k<nBoxConformal[l3][i2];k++){
6485  nHit_original = (Short_t) infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][3];
6486  if( !InclusionList[ nHit_original ] ) continue;
6487 // check if the hit position is near the circle of the Helix found by the fit
6488  dx = -Ox+info[ nHit_original ][0];
6489  dy = -Oy+info[ nHit_original ][1];
6490  distance = sqrt(dx*dx+dy*dy);
6491  if ( fabs(R - distance ) > NTIMES*STRAWRADIUS ) continue;
6492 
6493 //-------------------
6494  xx=infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][0];
6495  dist = fabs( xx +q );
6496 // if(dist < 3.*infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][2]){
6497  if( PndSttAcceptHitsConformal( dist,
6498  infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][2],
6499  infoparalConformal[ HitsinBoxConformal[k][l3][i2] ][4]
6500  ) ) {
6501  auxListHitsinTrack[nAssociatedHits]= HitsinBoxConformal[k][l3][i2];
6502  nAssociatedHits++;
6503  }
6504  } // end of for( k=0;k<nBoxConformal[l3][i2];k++)
6505  } // end of for(l=-2; l<3;l++)
6506  } // end of for(l2=0;l2<2;l2++)
6507  } // end of if((nR == nRdivConformalEffective-1 && passamin) || (nR==0 && passamax) )
6508 
6509 
6510 
6511  } // end of for(itemp=Fimin; itemp<=FFimax;itemp++)
6512 
6513 
6514  } else { // q=0 --> x=0
6515 
6516 
6517 
6518  if( FFimax > nRdivConformal/4 && FFimin < nRdivConformal/4 ) {
6519  iFi0 = (Short_t) (nRdivConformal/4 );
6520  } else if ( FFimax > 3*nRdivConformal/4 && FFimin < 3*nRdivConformal/4 ){
6521  iFi0 = (Short_t) (3*nRdivConformal/4 );
6522  } else {
6523  cout <<"From PndSttTrackFinderReal::PndSttTrkAssociatedParallelHitsToHelixQuater :"
6524  <<" inconsistency, 0 associated hits to this track candidate\n";
6525  return 0;
6526  }
6527 
6528  for(itemp=iFi0-5; itemp<=iFi0+5;itemp++){
6529  i=itemp;
6530  if( i< 0 ) {
6531  i += nFidivConformal;
6532  } else if (i>=nFidivConformal){
6533  i -= nFidivConformal*( i/nFidivConformal );
6534 // i -= nFidivConformal;
6535  }
6536  for(l=0; l<nRdivConformalEffective;l++){
6537  for( k=0;k<nBoxConformal[l][i];k++){
6538  nHit_original = (Short_t) infoparalConformal[ HitsinBoxConformal[k][l][i] ][3];
6539  if( !InclusionList[ nHit_original ] ) continue;
6540 // check if the hit position is near the circle of the Helix found by the fit
6541  dx = -Ox+info[ nHit_original ][0];
6542  dy = -Oy+info[ nHit_original ][1];
6543  distance = sqrt(dx*dx+dy*dy);
6544  if ( fabs(R - distance ) >NTIMES*STRAWRADIUS ) continue;
6545 
6546 //-------------------
6547  xx=infoparalConformal[ HitsinBoxConformal[k][l][i] ][0];
6548  dist = fabs( xx );
6549 
6550  if( PndSttAcceptHitsConformal( dist,
6551  infoparalConformal[ HitsinBoxConformal[k][l][i] ][2],
6552  infoparalConformal[ HitsinBoxConformal[k][l][i] ][4]
6553  ) ) {
6554  auxListHitsinTrack[nAssociatedHits]= HitsinBoxConformal[k][l][i];
6555  nAssociatedHits++;
6556  }
6557  } // end of for( k=0;k<nBoxConformal[l][i];k++)
6558  } // end of for(l=0; l<nRdivConformalEffective;l++)
6559  } // end of for(itemp=iFi0-5; itemp<=iFi0+5;itemp++)
6560 
6561 
6562 
6563 
6564  } // end of if(fabs(q) > 1.e-10 )
6565 
6566 
6567  } else if( fabs(q)> 1.e-10) { // second part of if( Status ==99), in this case y = m*x +q
6568 
6569 
6570  Fi0 = atan(m); // Fi0 belongs to (-PI/2, PI/2] .
6571  aaa = atan2(q, -m*q);
6572  if(Fi0<0.) {
6573  Fi0 += PI;
6574  if (Fi0 <0. ) Fi0 =0.;// this is between 0. and PI.
6575  if (Fi0 >PI ) Fi0 =PI;// this is between 0. and PI.
6576  };
6577  ddd= fabs(q)/sqrt(1.+m*m);
6578 
6579 
6580  for(itemp=FFimin; itemp<=FFimax;itemp++){
6581  i=itemp;
6582  if( i< 0 ) {
6583  i += nFidivConformal;
6584  } else if (i>=nFidivConformal){
6585  i -= nFidivConformal*( i/nFidivConformal );
6586  }
6587 
6588  // erre1 is the distance from origin of point of intersection of the straight
6589  // line of equation y= m*x+q with line of equation y = x*tan(fi1);
6590  // when erre1 is < 0 it means the intersection is on the opposite side of the
6591  // versor defined by [cos(fi1); sin(fi1)].
6592  // Here we are working in the conformal plane U,V.
6593 
6594  fi1 = i*2.*(PI/nFidivConformal);
6595  if( fabs(sin(fi1)-m*cos(fi1))>1.e-10) {
6596  erre1 = q/(sin(fi1)-m*cos(fi1));
6597  } else {
6598  erre1 = 99999999999.;
6599  }
6600 
6601  fi2 = (i+1)*2.*(PI/nFidivConformal);
6602  if( fabs(sin(fi2)-m*cos(fi2))>1.e-10) {
6603  erre2 = q/(sin(fi2)-m*cos(fi2));
6604  } else {
6605  erre2 = 99999999999.;
6606  }
6607 
6608 
6609  for(j=0; j<nRdivConformal; j++){
6610  Rin = radiaConf[j];
6611  if(j!=nRdivConformal-1) {
6612  Rout = radiaConf[j+1];
6613  } else {
6614  Rout = 1./RStrawDetectorMin;
6615  }
6616 
6617 // note that the following algorithm works also for negative erre1 and erre2
6618 
6619 
6620  if(erre1<-1.e-10 ){
6621  if(erre2< 0. || erre2 > Rout ){
6622  continue;
6623  }
6624  } else if(fabs(erre1) < 1.e-10){
6625  if( Fi0 > fi2 || Fi0 < fi1){
6626  continue;
6627  }
6628  } else if ( erre1<Rin) {
6629  if( erre2< Rin && erre2> 0. ) {
6630  continue;
6631  }
6632  } else if (erre1> Rout && erre2 > Rout && !( fi1<= aaa && aaa<=fi2 && ddd<=Rout )
6633  ) {
6634  continue;
6635  }
6636 
6637  for(l=itemp-2; l<=itemp+2; l++){
6638  if( l< 0 ) {
6639  l2 = l+nFidivConformal;
6640  } else if (l>=nFidivConformal){
6641  l2 = l- nFidivConformal*( l/nFidivConformal );
6642  } else {
6643  l2 = l;
6644  }
6645  if( j-1<0) {
6646  kstart=0;
6647  } else {
6648  kstart = j-1;
6649  }
6650  if ( j+1 >= nRdivConformal ) {
6651  kend = nRdivConformal;
6652  } else {
6653  kend = j+2;
6654  }
6655 
6656  for(k=kstart;k<kend;k++){
6657 
6658  for( l3=0;l3<nBoxConformal[k][l2];l3++){
6659  if( ! Unselected[HitsinBoxConformal[l3][k][l2] ] ) continue;
6660  nHit_original = (Short_t) infoparalConformal[ HitsinBoxConformal[l3][k][l2] ][3];
6661  if( !InclusionList[ nHit_original ] ) continue;
6662 // check if the hit position is near the circle of the Helix found by the fit
6663  dx = -Ox+info[ nHit_original ][0];
6664  dy = -Oy+info[ nHit_original ][1];
6665  distance = sqrt(dx*dx+dy*dy);
6666  if ( fabs(R - distance ) > NTIMES*STRAWRADIUS ) continue;
6667 
6668 //-------------------
6669  xx=infoparalConformal[ HitsinBoxConformal[l3][k][l2] ][0];
6670  yy=infoparalConformal[ HitsinBoxConformal[l3][k][l2] ][1];
6671  dist = fabs( -yy+ m*xx +q )/sqrt(m*m+1.);
6672  if( PndSttAcceptHitsConformal( dist,
6673  infoparalConformal[ HitsinBoxConformal[l3][k][l2] ][2],
6674  infoparalConformal[ HitsinBoxConformal[l3][k][l2] ][4]
6675  ) ) {
6676 
6677  auxListHitsinTrack[nAssociatedHits]= HitsinBoxConformal[l3][k][l2];
6678  Unselected[HitsinBoxConformal[l3][k][l2]]= false;
6679  nAssociatedHits++;
6680  }
6681 
6682  } // end of for( l3=0;l3<nBoxConformal[k][l2];l3++)
6683  } // end of for(k=kstart;k<kend;k++)
6684  } // end of for(l=itemp-1; l<itemp+2; l++)
6685 
6686  } // end of for(j=0; j<nRdivConformal; j++)
6687 
6688  } // end of for(itemp=FFimin; itemp<=FFimax;itemp++)
6689 
6690 
6691 
6692 
6693  } else { // case in which y= m*x , m can be zero , third part of if( Status ==99)
6694 
6695  iFi0 = (Short_t) (atan(m)*nRdivConformal/(2.*PI) );
6696  for(itemp=iFi0-5; itemp<=iFi0+5;itemp++){
6697  i=itemp;
6698  if( i< 0 ) {
6699  i += nFidivConformal;
6700  } else if (i>=nFidivConformal){
6701  i -= nFidivConformal*( i/nFidivConformal );
6702 // i -= nFidivConformal;
6703  }
6704  for(l=0; l<nRdivConformalEffective;l++){
6705  for( k=0;k<nBoxConformal[l][i];k++){
6706  nHit_original = (Short_t) infoparalConformal[ HitsinBoxConformal[k][l][i] ][3];
6707  if( !InclusionList[ nHit_original ] ) continue;
6708 // check if the hit position is near the circle of the Helix found by the fit
6709  dx = -Ox+info[ nHit_original ][0];
6710  dy = -Oy+info[ nHit_original ][1];
6711  distance = sqrt(dx*dx+dy*dy);
6712  if ( fabs(R - distance ) > NTIMES*STRAWRADIUS ) continue;
6713 
6714 //-------------------
6715  xx=infoparalConformal[ HitsinBoxConformal[k][l][i] ][0];
6716  yy=infoparalConformal[ HitsinBoxConformal[k][l][i] ][1];
6717  dist = fabs( m*xx-yy )/sqrt( m*m+1.);
6718  if( PndSttAcceptHitsConformal( dist,
6719  infoparalConformal[ HitsinBoxConformal[k][l][i] ][2],
6720  infoparalConformal[ HitsinBoxConformal[k][l][i] ][4]
6721  ) ) {
6722  auxListHitsinTrack[nAssociatedHits]= HitsinBoxConformal[k][l][i];
6723  nAssociatedHits++;
6724  }
6725  } // end of for( k=0;k<nBoxConformal[l][i];k++)
6726  }
6727  } // end of for(itemp=FFimin; itemp<=FFimax;itemp++)
6728 
6729 
6730 
6731 
6732 
6733  } // end of if ( Status ==99)
6734 
6735 
6736 if(istampa>=3) {
6737  cout<<"from PndSttTrkAssociatedParallelHitsToHelixQuater, before exiting; nAssociatedHits = "
6738  <<nAssociatedHits<<endl;
6739 }
6740 
6741 
6742 
6743  return nAssociatedHits;
6744 
6745 }
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 PndSttAcceptHitsConformal(Double_t distance, Double_t DriftConfR, Double_t StrawConfR)
static const Double_t RStrawDetectorMin
Double_t
static const Short_t nFidivConformal
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
double dx
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
static const Double_t STRAWRADIUS
Double_t radiaConf[nRdivConformal]
static const Short_t DELTAnR
Double_t angle
Double_t R
Definition: checkhelixhit.C:61
static const Short_t nRdivConformal
CalculatedCircles PndSttTrackFinderReal::PndSttTrkFindCircles ( Double_t  x1,
Double_t  y1,
Double_t  r1,
Double_t  x2,
Double_t  y2,
Double_t  r2,
Double_t  x3,
Double_t  y3,
Double_t  r3 
)
private

Definition at line 2537 of file PndSttTrackFinderReal.cxx.

References a, b, bp, C(), c, CalculatedCircles::CX, CalculatedCircles::CY, d, Double_t, i, CalculatedCircles::Ncircles, CalculatedCircles::R, R, r1, r2, sqrt(), T, and X.

2540 {
2541  Double_t a,b,c,d,ap,bp,cp,dp,radix,solution,Radius, A,B,C,D,AAA,BBB,CCC,DELTA,S,T,X;
2542  Int_t Nsol = 0;
2543  Double_t R[8],CX[8],CY[8];
2544  CalculatedCircles Ris ;
2545 
2546 //cout<<"---------------------------------- inizio printout da find_circles \n";
2547 
2548 
2549 /*
2550  x1 = X center crf 1;
2551  y1 = Y center crf 1;
2552  r1 = radius crf 1;
2553  x2 = X center crf 2;
2554  y2 = Y center crf 2;
2555  r2 = radius crf 2;
2556  x3 = X center crf 3;
2557  y3 = Y center crf 3;
2558  r3 = radius crf 3;
2559 */
2560 
2561  a=2.*(x1-x2);
2562  b=2.*(y1-y2);
2563  d= x1*x1+y1*y1-r1*r1-x2*x2-y2*y2+r2*r2;
2564  ap=2.*(x1-x3);
2565  bp=2.*(y1-y3);
2566  dp= x1*x1+y1*y1-r1*r1-x3*x3-y3*y3+r3*r3;
2567 
2568 /*
2569 cout<<"printout iniziale :\nx1="<<x1<<";\nx2="<<x2<<";\nx3="<<x3<<";\ny1="<<y1<<";\ny2="<<y2<<";\ny3="
2570  <<y3<<";\nr1="<<r1<<";\nr2="<<r2<<";\nr3="<<r3<<endl;
2571 cout<<" a= "<<a<<"; b="<<b<<"; d="<<d<<endl;
2572 cout<<" ap= "<<ap<<"; bp="<<bp<<"; dp="<<dp<<endl;
2573 cout<<"fine printout iniziale\n";
2574 */
2575 
2576  Double_t aaa= a*bp-b*ap;
2577 //cout<<"aaa : "<<aaa<<endl;
2578  if ( aaa == 0.) {
2579  for(Int_t i1=-1;i1<=1;i1+=2){
2580  for(Int_t i2=-1;i2<=1;i2+=2){
2581  c=-2.*(i1*r1-i2*r2);
2582  for(Int_t i3=-1;i3<=1;i3+=2){
2583  cp=-2.*(i1*r1-i3*r3);
2584  if( bp*c-b*cp == 0. && b == 0. && bp == 0. && a != 0. && ap != 0. && a != ap && ap*c-a*cp != 0.){
2585  Radius = (a*dp-ap*d)/(ap*c-a*cp);
2586  if ( Radius >0.){
2587  S = d/a;
2588  T = -c/a;
2589  BBB = y1;
2590  CCC = (S-T*Radius)*(S-T*Radius)-Radius*Radius-2.*x1*(S-T*Radius)-2.*i1*Radius*r1+x1*x1+y1*y1-r1*r1;
2591  DELTA = BBB*BBB-CCC;
2592  if(DELTA<0.) {
2593  continue;
2594  } else if (DELTA ==0.){
2595  Nsol++;
2596  R[Nsol-1] = Radius ;
2597  CX[Nsol-1] = S-T*Radius;
2598  CY[Nsol-1] = -BBB;
2599  } else{
2600  Nsol+=2;
2601  R[Nsol-2] = Radius ;
2602  CX[Nsol-2] = S-T*Radius;
2603  CY[Nsol-2] = -BBB+sqrt(DELTA);
2604  R[Nsol-1] = Radius ;
2605  CX[Nsol-1] = S-T*Radius;
2606  CY[Nsol-1] = -BBB-sqrt(DELTA);
2607  }
2608 
2609  } // end if ( Radius >0.)
2610  } else if(bp*c-b*cp != 0.) {
2611 
2612  Radius = (-bp*d+b*dp)/(bp*c-b*cp) ;
2613  if( Radius > 0. && b != 0. ){
2614  S = (d+c*Radius)/b;
2615  T = a/b;
2616  AAA = 1+T*T;
2617  BBB = -(T*S+x1-T*y1);
2618  CCC = S*S-Radius*Radius-2.*y1*S-2.*i1*r1*Radius+x1*x1+y1*y1-r1*r1;
2619  DELTA= BBB*BBB-AAA*CCC;
2620 //cout<<"AAA ="<<AAA<<", BBB= "<<BBB<<", CCC ="<<CCC<<", DELTA= "<<DELTA<<endl;
2621 //cout<<"S = "<<S<<", T= "<<T<<endl<<"DELTA "<<DELTA<<endl;
2622  if(DELTA<0.) {
2623  continue;
2624  } else if (DELTA ==0.){
2625  Nsol++;
2626  R[Nsol-1] = Radius ;
2627  CX[Nsol-1] = -BBB/AAA;
2628  CY[Nsol-1] = S-T*CX[Nsol-1];
2629 // cout<<"CX[Nsol-1] ="<<CX[Nsol-1]<<", CY[Nsol-1]= "<<CY[Nsol-1]<<endl;
2630  } else {
2631  Nsol+=2;
2632  R[Nsol-2] = Radius ;
2633  CX[Nsol-2] = (-BBB+sqrt(DELTA))/AAA;
2634  CY[Nsol-2] = S-T*CX[Nsol-2];
2635  R[Nsol-1] = Radius ;
2636  CX[Nsol-1] = (-BBB-sqrt(DELTA))/AAA;
2637  CY[Nsol-1] = S-T*CX[Nsol-1];
2638 //cout<<"CX[Nsol-2] ="<<CX[Nsol-2]<<", CY[Nsol-2]= "<<CY[Nsol-2]<<endl;
2639 //cout<<"CX[Nsol-1] ="<<CX[Nsol-1]<<", CY[Nsol-1]= "<<CY[Nsol-1]<<endl;
2640  } // end if(DELTA<0.)
2641  } // end if( Radius > 0. && b != 0. )
2642  } // end if( bp*c-b*cp == 0.)
2643  } // end for (Int_t i3
2644  } // end for(Int_t i2
2645  } // end for(Int_t i1
2646 
2647  } else { // of if(aaa == 0. )
2648 
2649  A=(bp*d-b*dp)/aaa;
2650  C=(-ap*d+a*dp)/aaa;
2651 // cout<<"aaa "<<aaa<<endl<<"A "<<A<<endl<<"C "<<C<<endl;
2652  for(Int_t i1=-1;i1<=1;i1+=2){
2653  for(Int_t i2=-1;i2<=1;i2+=2){
2654  c=-2.*(i1*r1-i2*r2);
2655  for(Int_t i3=-1;i3<=1;i3+=2){
2656  cp=-2.*(i1*r1-i3*r3);
2657 // cout<<"----------------------------------------\n";
2658 // cout<<"c="<<c<<"; cp="<<cp<<endl;
2659 
2660  B=(bp*c-b*cp)/aaa;
2661  D=(-ap*c+a*cp)/aaa;
2662 
2663  AAA = B*B+D*D-1.;
2664  BBB = A*B+C*D-B*x1-D*y1-i1*r1;
2665  CCC = A*A+C*C-2.*x1*A-2.*y1*C+x1*x1+y1*y1-r1*r1;
2666  DELTA = BBB*BBB - CCC*AAA;
2667 // cout<<"caso con i1= "<<i1<<", i2, i3 = "<<" "<<i2<<" "<<i3<<endl
2668 // <<"A "<<A<<"; B = "<<B<<"; C= "<<C<<"; D = "<<D<<endl;
2669 // cout<<"AAA = "<<AAA<<"; BBB = "<<BBB<<" DELTA "<<DELTA<<endl;
2670 // cout<<"sqrt(DELTA) = "<<sqrt(DELTA)<<endl;
2671 
2672  if (DELTA <0.) { continue; }
2673  else if (DELTA==0.){
2674  if( BBB==0. ){
2675  continue;
2676  } else {
2677  solution=-BBB/AAA;
2678  if(solution > 0.){
2679  Nsol++;
2680  R[Nsol-1] = solution;
2681  CX[Nsol-1] = A+B*R[Nsol-1];
2682  CY[Nsol-1] = C+D*R[Nsol-1];
2683  }
2684  continue;
2685  }
2686  }
2687 
2688 // this is the case when DELTA > 0.
2689 
2690  radix = sqrt(DELTA);
2691 
2692  if (AAA == 0.) {
2693  cout<<"AAA== 0.";
2694  continue;
2695  } else {
2696 
2697  solution=(-BBB+radix)/AAA;
2698 //cout<<"-BBB[j] radix AAA[j] : "<<-BBB <<"; "<< radix <<"; "<< AAA<<"; solution=+ :"<<solution<<endl;
2699  if(solution > 0.){
2700  Nsol++;
2701  R[Nsol-1] = solution;
2702  CX[Nsol-1] = A+B*R[Nsol-1];
2703  CY[Nsol-1] = C+D*R[Nsol-1];
2704  }
2705 
2706 
2707  solution=(-BBB-radix)/AAA;
2708 //cout<<"-BBB[j] radix AAA[j] : "<<-BBB <<"; "<< radix <<"; "<< AAA<<"; solution=- :"<<solution<<endl;
2709  if(solution > 0.){
2710  Nsol++;
2711  R[Nsol-1] = solution;
2712  CX[Nsol-1] = A+B*R[Nsol-1];
2713  CY[Nsol-1] = C+D*R[Nsol-1];
2714  }
2715 
2716 
2717 
2718  } // end of if(AAA == 0.)
2719 
2720 
2721  } // end for(i3
2722  } // end for(i2
2723  } // end for(i1
2724 
2725 
2726 
2727  } // end if ( aaa == 0.)
2728 
2729 
2730 
2731 
2732 //cout<<"----------------------------------------\n";
2733 // cout<<"n. soluzioni : "<<Nsol<<endl;
2734  Ris.Ncircles=Nsol;
2735  for(Int_t i=0; i<Nsol;i++){
2736 // cout<<"Soluzione n. "<<i+1<<"; R = "<<R[i]<<", CX = "<<CX[i]<<", CY = "<<CY[i]<<endl;
2737  Ris.CX[i]=CX[i];
2738  Ris.CY[i]=CY[i];
2739  Ris.R[i] =R[i];
2740  }
2741 
2742 
2743 
2744  return Ris;
2745 
2746 }
TObjArray * d
Int_t i
Definition: run_full.C:25
TTree * b
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
double r1
int Pic_FED Eff_lEE C()
TTree * T
Definition: anaLmdReco.C:32
Int_t a
Definition: anaLmdDigi.C:126
Double_t
double X
Definition: anaLmdDigi.C:68
TF1 * bp
Definition: hist-t7.C:69
Double_t R
Definition: checkhelixhit.C:61
double r2
CalculatedHelix PndSttTrackFinderReal::PndSttTrkFindHelix ( Double_t  Ox,
Double_t  Oy,
Double_t  R,
Double_t  Zcenter1,
Double_t  Zcenter2,
Double_t  Zcenter3,
Double_t  semilengthStraight1,
Double_t  semilengthStraight2,
Double_t  semilengthStraight3,
Double_t  C0x1,
Double_t  C0y1,
Double_t  C0z1,
Double_t  semilengthSkew1,
Double_t  r1,
Double_t  vx1,
Double_t  vy1,
Double_t  vz1,
Double_t  C0x2,
Double_t  C0y2,
Double_t  C0z2,
Double_t  semilengthSkew2,
Double_t  r2,
Double_t  vx2,
Double_t  vy2,
Double_t  vz2,
Int_t *  STATUS 
)
private
void PndSttTrackFinderReal::SeparateInnerOuterParallel ( Short_t  nHits,
Short_t *  ListHits,
Double_t  info[][7],
Double_t  RStrawDetInnerParMax,
Short_t *  nInnerHits,
Short_t *  ListInnerHits,
Short_t *  nOuterHits,
Short_t *  ListOuterHits,
Short_t *  nInnerHitsLeft,
Short_t *  ListInnerHitsLeft,
Short_t *  nInnerHitsRight,
Short_t *  ListInnerHitsRight,
Short_t *  nOuterHitsLeft,
Short_t *  ListOuterHitsLeft,
Short_t *  nOuterHitsRight,
Short_t *  ListOuterHitsRight 
)
private

Definition at line 12124 of file PndSttTrackFinderReal.cxx.

References ApotemaMaxInnerParStraw, Double_t, nHits, r, and sqrt().

12148 {
12149 
12150  Short_t ihit;
12151 
12152  Double_t r;
12153 
12154 // separation of inner Parallel Stt hits from outer Parallel Stt hits.
12155 
12156  *nInnerHits=0;
12157  *nInnerHitsLeft=0;
12158  *nInnerHitsRight=0;
12159  *nOuterHits=0;
12160  *nOuterHitsLeft=0;
12161  *nOuterHitsRight=0;
12162  for(ihit=0 ;ihit<nHits;ihit++){
12163  r = sqrt( info[ListHits[ihit]][0]*info[ListHits[ihit]][0] +
12164  info[ListHits[ihit]][1]*info[ListHits[ihit]][1]);
12165  // the value 2.*RStrawDetectorParMax/sqrt(3.) is because RStrawDetectorParMax
12166  // is an Apotema !
12167  if(r>2.*ApotemaMaxInnerParStraw/sqrt(3.) ){ // outer Parallel hit.
12168  ListOuterHits[ *nOuterHits ] = ListHits[ihit];
12169  (*nOuterHits)++;
12170  if(info[ListHits[ihit]][0]<0.){
12171  ListOuterHitsLeft[ *nOuterHitsLeft ] = ListHits[ihit];
12172  (*nOuterHitsLeft)++;
12173  } else {
12174  ListOuterHitsRight[ *nOuterHitsRight ] = ListHits[ihit];
12175  (*nOuterHitsRight)++;
12176  }
12177  }else{
12178  ListInnerHits[ *nInnerHits ] = ListHits[ihit];
12179  (*nInnerHits)++;
12180  if(info[ListHits[ihit]][0]<0.){
12181  ListInnerHitsLeft[ *nInnerHitsLeft ] = ListHits[ihit];
12182  (*nInnerHitsLeft)++;
12183  } else {
12184  ListInnerHitsRight[ *nInnerHitsRight ] = ListHits[ihit];
12185  (*nInnerHitsRight)++;
12186  }
12187  }
12188  }
12189 
12190 }
double r
Definition: RiemannTest.C:14
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
int nHits
Definition: RiemannTest.C:16
Double_t
static const Double_t ApotemaMaxInnerParStraw
void PndSttTrackFinder::SetHelixHitProduction ( Bool_t  hhprod)
inlineinherited

set the helix hit production flag true or false

Definition at line 64 of file PndSttTrackFinder.h.

References PndSttTrackFinder::fHelixHitProduction.

Referenced by PndSttFindTracks::Init().

64 { fHelixHitProduction = hhprod; };
void PndSttTrackFinderReal::SetInputBranchName ( char *  string1)
inlinevirtual

Implements PndSttTrackFinder.

Definition at line 77 of file PndSttTrackFinderReal.h.

References fSttBranch.

78  {
79  sprintf(fSttBranch,"%s", string1);
80  return;
81  };
void PndSttTrackFinderReal::SetTubeArray ( TClonesArray *  tubeArray)
inlinevirtual

CHECK added

Implements PndSttTrackFinder.

Definition at line 74 of file PndSttTrackFinderReal.h.

References fTubeArray.

74 { fTubeArray = tubeArray; };
void PndSttTrackFinder::SetVerbose ( Int_t  verbose)
inlineinherited

Set verbosity

Parameters
verboseVerbosity level

Definition at line 61 of file PndSttTrackFinder.h.

References PndSttTrackFinder::fVerbose, and verbose.

Referenced by PndSttFindTracks::Init().

61 { fVerbose = verbose; };
#define verbose
bool PndSttTrackFinderReal::SttParalCleanup ( Double_t  GAP,
Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Short_t  Charge,
Double_t  Start[3],
Double_t  FI0,
Double_t  FiLimitAdmissible,
Short_t  nHits,
Short_t *  Listofhits,
Double_t  info[][7],
Double_t  RStrawDetMin,
Double_t  RStrawDetInnerParMax,
Double_t  RStrawDetOuterParMin,
Double_t  RStrawDetMax 
)
private
bool PndSttTrackFinderReal::SttSkewCleanup ( Double_t  GAP,
Double_t  Oxx,
Double_t  Oyy,
Double_t  Rr,
Short_t  Charge,
Double_t  Start[3],
Double_t  FI0,
Double_t  FiLimitAdmissible,
Short_t  nHits,
Short_t *  Listofhits,
Double_t S,
Double_t  info[][7],
Double_t  RminStrawSkew,
Double_t  RmaxStrawSkew,
Double_t  cut,
Short_t  maxnum 
)
private
void PndSttTrackFinderReal::WriteHistograms ( )

Histogramming

Definition at line 253 of file PndSttTrackFinderReal.cxx.

References file, hdist, hdistbadlast, hdistgoodlast, and iplotta.

253  {
254 
255  TFile* file = FairRootManager::Instance()->GetOutFile();
256  file->cd();
257  file->mkdir("PndSttTrackFinderReal");
258  file->cd("PndSttTrackFinderReal");
259 
260  if(iplotta){
261  hdist->Write();
262  hdistgoodlast->Write();
263  hdistbadlast->Write();
264  delete hdist;
265  delete hdistgoodlast;
266  delete hdistbadlast;
267  }
268 
269 }
TFile * file
void PndSttTrackFinderReal::WriteMacroParallelAssociatedHits ( Double_t  Ox,
Double_t  Oy,
Double_t  R,
Short_t  Nhits,
Short_t  ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
Double_t  info[][7],
Int_t  Nincl,
Int_t  Minclinations[],
Double_t  inclination[][3],
Short_t  imaxima,
Int_t  sequencial,
Short_t  nscitilhitsintrack,
Short_t *  listscitilhitsintrack 
)
private

Definition at line 4517 of file PndSttTrackFinderReal.cxx.

References angle, ccc, disegnaAssiXY(), disegnaSciTilHit(), Double_t, dx, dy, i, infoparal, IVOLTE, offset(), posizSciTil, xmax, xmin, and zpos.

Referenced by DoFind().

4530 {
4531 
4532  Int_t i, j, i1, ii, index, Kincl, nlow, nup, STATUS;
4533 
4534  Double_t xmin , xmax, ymin, ymax,
4535  dx, dy, diff, d1, d2,
4536  delta, deltax, deltay, deltaz, deltaS,
4537  factor,
4538  zmin, zmax, Smin, Smax, S1, S2,
4539  z1, z2, y1, y2,
4540  vx1, vy1, vz1, C0x1, C0y1, C0z1,
4541  aaa, bbb, ccc, angle, minor, major,
4542  distance, Rx, Ry, LL,
4543  Aellipsis1, Bellipsis1,fi1,
4544  fmin, fmax, offset, step,
4545  SkewInclWithRespectToS, zpos, zpos1, zpos2,
4546  Tiltdirection1[2],
4547  zl[200],zu[200],
4548  POINTS1[6];
4549 
4550 
4551 
4552 
4553 
4554 // Ox = (D+R)*cos(Fi);
4555 // Oy = (D+R)*sin(Fi);
4556 
4557 //cout<<"da MacroTrackparalleletc. Ox, Oy "<<Ox<<", "<<Oy<<endl;
4558 
4559 
4560 //---------- parallel straws Macro now
4561  char nome[300], nome2[300];
4562  sprintf(nome,"MacroSttParEvent%dT%d", IVOLTE,sequencial);
4563  sprintf(nome2,"%s.C",nome);
4564  FILE * MACRO = fopen(nome2,"w");
4565  fprintf(MACRO,"void %s()\n{\n",nome);
4566  xmin=1.e20;
4567  xmax=-1.e20;
4568  ymin=1.e20;
4569  ymax=-1.e20;
4570 
4571 //---- Scitil hits.
4572  if(nscitilhitsintrack>0) {
4573  for(j=0;j<nscitilhitsintrack;j++){
4574  i = listscitilhitsintrack[j] ;
4575  if (posizSciTil[i][0] < xmin) xmin = posizSciTil[i][0];
4576  if (posizSciTil[i][0] > xmax) xmax = posizSciTil[i][0];
4577  if (posizSciTil[i][1] < ymin) ymin = posizSciTil[i][1];
4578  if (posizSciTil[i][1] > ymax) ymax = posizSciTil[i][1];
4579  }
4580  }
4581 //-------------
4582 
4583  for( ii=0; ii< Nhits; ii++) {
4584  i = infoparal[ ListHitsinTrack[imaxima][ii] ] ;
4585  if (info[i][0]-info[i][3] < xmin) xmin = info[i][0]-info[i][3];
4586  if (info[i][0]+info[i][3] > xmax) xmax = info[i][0]+info[i][3];
4587  if (info[i][1]-info[i][3] < ymin) ymin = info[i][1]-info[i][3];
4588  if (info[i][1]+info[i][3] > ymax) ymax = info[i][1]+info[i][3];
4589  }
4590 
4591  if( xmin > 0. ) xmin = 0.;
4592  if( xmax < 0.) xmax = 0.;
4593  if( ymin > 0. ) ymin = 0.;
4594  if( ymax < 0.) ymax = 0.;
4595 
4596  deltax = xmax-xmin;
4597  deltay = ymax - ymin;
4598 
4599  if( deltax > deltay) {
4600  ymin -= 0.5*(deltax-deltay);
4601  ymax = ymin+ deltax;
4602  delta = deltax;
4603  } else {
4604  xmin -= 0.5*(deltay-deltax);
4605  xmax = xmin+ deltay;
4606  delta= deltay;
4607  }
4608 
4609  xmax = xmax + delta*0.15;
4610  xmin = xmin - delta*0.15;
4611 
4612  ymax = ymax + delta*0.15;
4613  ymin = ymin - delta*0.15;
4614 
4615 
4616  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
4617 
4618  fprintf(MACRO,"TEllipse* TC = new TEllipse(%f,%f,%f,%f,0.,360.);\n",Ox,Oy,R,R);
4619  fprintf(MACRO,"TC->SetLineColor(2);\nTC->SetFillStyle(0);\nTC->Draw();\n");
4620 
4621 
4622  disegnaAssiXY(MACRO,xmin,xmax,ymin,ymax);
4623 
4624  for( ii=0; ii< Nhits; ii++) {
4625  i = infoparal[ ListHitsinTrack[imaxima][ii] ] ;
4626  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);\nE%d->Draw();\n",
4627  i,info[i][0],info[i][1],info[i][3],info[i][3],i,i);
4628  }
4629 
4630 
4631 //---- disegna gli Scitil.
4632 
4633  if(nscitilhitsintrack>0) {
4634  for(j=0;j<nscitilhitsintrack;j++){
4635  i = listscitilhitsintrack[j] ;
4636 /*
4637  fprintf(MACRO,"TMarker* SciT%d = new TMarker(%f,%f,%d);\n",
4638  i,posizSciTil[i][0],posizSciTil[i][1],30);
4639  fprintf(MACRO,"SciT%d->SetMarkerSize(1.5);\n",i);
4640  fprintf(MACRO,"SciT%d->SetMarkerColor(1);\nSciT%d->Draw();\n"
4641  ,i,i);
4642 */
4644  MACRO,
4645  i,
4646  posizSciTil[i][0],
4647  posizSciTil[i][1],
4648  0
4649  );
4650 
4651  }
4652  }
4653 //------------------------
4654 
4655 
4656 
4657 
4658  fprintf(MACRO,"}\n");
4659  fclose(MACRO);
4660 
4661 
4662 
4663 
4664 
4665  return ;
4666 
4667 }
double dy
Int_t i
Definition: run_full.C:25
Double_t posizSciTil[nmaxSciTilHits][3]
Double_t xmax
TVector3 offset(2, 0, 0)
void disegnaAssiXY(FILE *MACRO, double xmin, double xmax, double ymin, double ymax)
Double_t
const Double_t zpos
double dx
void disegnaSciTilHit(FILE *MACRO, int ScitilHit, double posx, double posy, int tipo)
Double_t xmin
Double_t angle
Double_t R
Definition: checkhelixhit.C:61
void PndSttTrackFinderReal::WriteMacroParallelAssociatedHitswithMC ( Double_t  Ox,
Double_t  Oy,
Double_t  R,
Short_t  TrackFoundaTrackMC,
Short_t  Nhits,
Short_t  ListHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
Double_t  info[][7],
Short_t  ifoundtrack,
Int_t  sequentialNTrack,
Short_t  nscitilhitsintrack,
Short_t *  listscitilhitsintrack,
Short_t  nParalCommon[MAXTRACKSPEREVENT],
Short_t  ParalCommonList[MAXTRACKSPEREVENT][nmaxHits],
Short_t  nSpuriParinTrack[MAXTRACKSPEREVENT],
Short_t  ParSpuriList[MAXTRACKSPEREVENT][nmaxHits],
Short_t  nMCParalAlone[MAXTRACKSPEREVENT],
Short_t  MCParalAloneList[MAXTRACKSPEREVENT][nmaxHits] 
)
private

Definition at line 4680 of file PndSttTrackFinderReal.cxx.

References angle, BFIELD, ccc, CVEL, disegnaAssiXY(), disegnaSciTilHit(), Double_t, dx, dy, fabs(), fMCTrackArray, fParticle, PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), PndMCTrack::GetStartVertex(), i, infoparal, IVOLTE, offset(), posizSciTil, sqrt(), xmax, xmin, and zpos.

Referenced by DoFind().

4699 {
4700 
4701  Int_t i, j, i1, ii, index, imaxima, Kincl, nlow, nup, STATUS;
4702 
4703  Double_t xmin , xmax, ymin, ymax,
4704  dx, dy, diff, d1, d2,
4705  delta, deltax, deltay, deltaz, deltaS,
4706  factor,
4707  zmin, zmax, Smin, Smax, S1, S2,
4708  z1, z2, y1, y2,
4709  vx1, vy1, vz1, C0x1, C0y1, C0z1,
4710  aaa, bbb, ccc, angle, minor, major,
4711  distance, Rx, Ry, LL,
4712  Aellipsis1, Bellipsis1,fi1,
4713  fmin, fmax, offset, step,
4714  SkewInclWithRespectToS, zpos, zpos1, zpos2,
4715  Tiltdirection1[2],
4716  zl[200],zu[200],
4717  POINTS1[6];
4718 
4719 
4720 
4721  imaxima=ifoundtrack;
4722 
4723 
4724 
4725 //---------- parallel straws Macro now
4726  char nome[300], nome2[300];
4727  sprintf(nome,"MacroSttParwithMCEvent%dT%d", IVOLTE,sequentialNTrack);
4728  sprintf(nome2,"%s.C",nome);
4729  FILE * MACRO = fopen(nome2,"w");
4730  fprintf(MACRO,"void %s()\n{\n",nome);
4731  xmin=1.e20;
4732  xmax=-1.e20;
4733  ymin=1.e20;
4734  ymax=-1.e20;
4735 
4736 //---- Scitil hits.
4737  if(nscitilhitsintrack>0) {
4738  for(j=0;j<nscitilhitsintrack;j++){
4739  i = listscitilhitsintrack[j] ;
4740  if (posizSciTil[i][0] < xmin) xmin = posizSciTil[i][0];
4741  if (posizSciTil[i][0] > xmax) xmax = posizSciTil[i][0];
4742  if (posizSciTil[i][1] < ymin) ymin = posizSciTil[i][1];
4743  if (posizSciTil[i][1] > ymax) ymax = posizSciTil[i][1];
4744  }
4745  }
4746 //-------------
4747 
4748  for( ii=0; ii< Nhits; ii++) {
4749  i = infoparal[ ListHitsinTrack[imaxima][ii] ] ;
4750  if (info[i][0]-info[i][3] < xmin) xmin = info[i][0]-info[i][3];
4751  if (info[i][0]+info[i][3] > xmax) xmax = info[i][0]+info[i][3];
4752  if (info[i][1]-info[i][3] < ymin) ymin = info[i][1]-info[i][3];
4753  if (info[i][1]+info[i][3] > ymax) ymax = info[i][1]+info[i][3];
4754  }
4755 
4756  if( xmin > 0. ) xmin = 0.;
4757  if( xmax < 0.) xmax = 0.;
4758  if( ymin > 0. ) ymin = 0.;
4759  if( ymax < 0.) ymax = 0.;
4760 
4761  deltax = xmax-xmin;
4762  deltay = ymax - ymin;
4763 
4764  if( deltax > deltay) {
4765  ymin -= 0.5*(deltax-deltay);
4766  ymax = ymin+ deltax;
4767  delta = deltax;
4768  } else {
4769  xmin -= 0.5*(deltay-deltax);
4770  xmax = xmin+ deltay;
4771  delta= deltay;
4772  }
4773 
4774  xmax = xmax + delta*0.15;
4775  xmin = xmin - delta*0.15;
4776 
4777  ymax = ymax + delta*0.15;
4778  ymin = ymin - delta*0.15;
4779 
4780 
4781  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
4782 
4783  fprintf(MACRO,"TEllipse* TC = new TEllipse(%f,%f,%f,%f,0.,360.);\n",Ox,Oy,R,R);
4784  fprintf(MACRO,"TC->SetLineColor(2);\nTC->SetFillStyle(0);\nTC->Draw();\n");
4785 
4786  disegnaAssiXY(MACRO,xmin,xmax,ymin,ymax);
4787 
4788  for( ii=0; ii< nParalCommon[ifoundtrack]; ii++) {
4789  i = ParalCommonList[ifoundtrack][ii] ;
4790  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);",
4791  i,info[i][0],info[i][1],info[i][3],info[i][3],i);
4792  fprintf(MACRO,"E%d->Draw();\n",i);
4793  }
4794 
4795  for( ii=0; ii< nSpuriParinTrack[ifoundtrack]; ii++) {
4796  i = ParSpuriList[ifoundtrack][ii] ;
4797  fprintf(MACRO,
4798  "TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);",
4799  i,info[i][0],info[i][1],info[i][3],info[i][3],i);
4800  fprintf(MACRO,"E%d->SetLineColor(2);\n",i);
4801  fprintf(MACRO,"E%d->Draw();\n",i);
4802  }
4803 
4804  for( ii=0; ii< nMCParalAlone[ifoundtrack]; ii++) {
4805  i = MCParalAloneList[ifoundtrack][ii] ;
4806  fprintf(MACRO,
4807  "TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);",
4808  i,info[i][0],info[i][1],info[i][3],info[i][3],i);
4809  fprintf(MACRO,"E%d->SetLineColor(4);\n",i);
4810  fprintf(MACRO,"E%d->Draw();\n",i);
4811  }
4812 
4813 
4814 
4815 //---- disegna gli Scitil.
4816 
4817  if(nscitilhitsintrack>0) {
4818  for(j=0;j<nscitilhitsintrack;j++){
4819  i = listscitilhitsintrack[j] ;
4820 /*
4821  fprintf(MACRO,"TMarker* SciT%d = new TMarker(%f,%f,%d);\n",
4822  i,posizSciTil[i][0],posizSciTil[i][1],30);
4823  fprintf(MACRO,"SciT%d->SetMarkerSize(1.5);\n",i);
4824  fprintf(MACRO,"SciT%d->SetMarkerColor(1);\nSciT%d->Draw();\n"
4825  ,i,i);
4826 */
4828  MACRO,
4829  i,
4830  posizSciTil[i][0],
4831  posizSciTil[i][1],
4832  0
4833  );
4834 
4835  }
4836  }
4837 //------------------------
4838 
4839 
4840 
4841 
4842 
4843 
4844 
4845 //--------------------------- ora le tracce MC
4846  Int_t icode, im;
4847  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica ;
4848  PndMCTrack* pMC;
4849  if( TrackFoundaTrackMC > -1){
4850  im=TrackFoundaTrackMC;
4851  pMC = (PndMCTrack*) fMCTrackArray->At(im);
4852  if ( pMC ) {
4853  icode = pMC->GetPdgCode() ; // PDG code of track
4854  Oxx = pMC->GetStartVertex().X(); // X of starting point track
4855  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
4856  Px = pMC->GetMomentum().X();
4857  Py = pMC->GetMomentum().Y();
4858  aaa = sqrt( Px*Px + Py*Py);
4859  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
4860  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
4861  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
4862  if (icode>1000000000) carica = 1.;
4863  else carica = fParticle->Charge()/3. ; // charge of track
4864  if( fabs(carica)>=0.1){
4865  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
4866  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
4867  fprintf(MACRO,"TEllipse* MC%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nMC%d->SetFillStyle(0);\nMC%d->SetLineColor(3);\nMC%d->Draw();\n",
4868  im,Cx,Cy,Rr,Rr,im,im,im);
4869  } // end of if( fabs(carica)>=0.1)
4870  } // end of if ( pMC )
4871 
4872  } // end of if( TrackFoundaTrackMC > -1){
4873 
4874 //----------- fine parte del MC
4875 
4876 
4877 
4878  fprintf(MACRO,"}\n");
4879  fclose(MACRO);
4880 
4881 
4882 
4883 
4884 
4885  return ;
4886 
4887 }
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
Double_t posizSciTil[nmaxSciTilHits][3]
Double_t xmax
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
TVector3 offset(2, 0, 0)
void disegnaAssiXY(FILE *MACRO, double xmin, double xmax, double ymin, double ymax)
Int_t * fParticle
Definition: run_full.C:24
Double_t
const Double_t zpos
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
double dx
void disegnaSciTilHit(FILE *MACRO, int ScitilHit, double posx, double posy, int tipo)
static const Double_t CVEL
Double_t xmin
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
Double_t R
Definition: checkhelixhit.C:61
void PndSttTrackFinderReal::WriteMacroParallelHitsConformalwithMCspecial ( Int_t  Nhits,
Double_t  auxinfoparalConformal[][5],
Short_t  nTracksFoundSoFar,
Short_t  Status,
Double_t trajectory_vertex 
)
private

Definition at line 4242 of file PndSttTrackFinderReal.cxx.

References ALFA, angle, BETA, BFIELD, ccc, CVEL, cx, CxMC, cy, Double_t, dx, dy, fabs(), fMCTrackArray, fParticle, GAMMA, PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), PndMCTrack::GetStartVertex(), i, IVOLTE, nmaxHits, nMCTracks, offset(), sqrt(), xmax, xmin, and zpos.

4253 {
4254 
4255  Int_t i, j, i1, ii, index, Kincl, nlow, nup, STATUS;
4256 
4257  Double_t xmin , xmax, ymin, ymax, xl, xu, yl, yu, rrr, cx, cy,
4258  Ox[nmaxHits], Oy[nmaxHits], Radius[nmaxHits], alfa, beta, gamma,
4259  dx, dy, diff, d1, d2,
4260  delta, deltax, deltay, deltaz, deltaS,
4261  factor,ff,
4262  zmin, zmax, Smin, Smax, S1, S2,
4263  z1, z2, y1, y2,x1,x2,
4264  vx1, vy1, vz1, C0x1, C0y1, C0z1,
4265  aaa, bbb, ccc, angle, minor, major,
4266  distance, Rx, Ry, LL,
4267  Aellipsis1, Bellipsis1,fi1,
4268  fmin, fmax, offset, step,
4269  SkewInclWithRespectToS, zpos, zpos1, zpos2,
4270  zl[200],zu[200];
4271 
4272 
4273 
4274 
4275 
4276 
4277 //---------- parallel straws Macro now
4278  char nome[300], nome2[300];
4279  FILE * MACRO;
4280 
4281 
4282 // ora riplotto tutto nello spazio conforme usando la trasformazione u= x/(x**2+y**2) e v = y/(x**2+y**2)
4283 //
4284 
4285  sprintf(nome,"MacroSttParConformewithMCspecialEvent%dTrack%d", IVOLTE,nTracksFoundSoFar);
4286  sprintf(nome2,"%s.C",nome);
4287  MACRO = fopen(nome2,"w");
4288  fprintf(MACRO,"void %s()\n{\n",nome);
4289  xmin=1.e20;
4290  xmax=-1.e20;
4291  ymin=1.e20;
4292  ymax=-1.e20;
4293  for( i=0; i< Nhits; i++) {
4294 // if( i== iExclude) continue;
4295 // centro sfera in sistema conforme
4296  Ox[i] = auxinfoparalConformal[i][0] ;
4297  Oy[i] = auxinfoparalConformal[i][1] ;
4298  Radius[i] = auxinfoparalConformal[i][2];
4299  if (Ox[i]-Radius[i] < xmin) xmin = Ox[i]-Radius[i];
4300  if (Ox[i]+Radius[i] > xmax) xmax = Ox[i]+Radius[i];
4301  if (Oy[i]-Radius[i] < ymin) ymin = Oy[i]-Radius[i];
4302  if (Oy[i]+Radius[i] > ymax) ymax = Oy[i]+Radius[i];
4303  }
4304 
4305  if( xmin > 0. ) xmin = 0.;
4306  if( xmax < 0.) xmax = 0.;
4307  if( ymin > 0. ) ymin = 0.;
4308  if( ymax < 0.) ymax = 0.;
4309 
4310  deltax = xmax-xmin;
4311  deltay = ymax - ymin;
4312 
4313  if( deltax > deltay) {
4314  ymin -= 0.5*(deltax-deltay);
4315  ymax = ymin+ deltax;
4316  delta = deltax;
4317  } else {
4318  xmin -= 0.5*(deltay-deltax);
4319  xmax = xmin+ deltay;
4320  delta= deltay;
4321  }
4322 
4323  xmax = xmax + delta*0.15;
4324  xmin = xmin - delta*0.15;
4325 
4326  ymax = ymax + delta*0.15;
4327  ymin = ymin - delta*0.15;
4328 
4329 
4330  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
4331 
4332 
4333  fprintf(MACRO,"TGaxis *Assex = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",xmin,0.,xmax,0.,xmin,xmax);
4334  fprintf(MACRO,"Assex->Draw();\n");
4335  fprintf(MACRO,"TGaxis *Assey = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n", 0.,ymin,0.,ymax,ymin,ymax);
4336  fprintf(MACRO,"Assey->Draw();\n");
4337 
4338 
4339  for( i=0; i< Nhits; i++) {
4340 // if( i== iExclude) continue;
4341  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetLineWidth(2);\nE%d->SetFillStyle(0);\nE%d->Draw();\n",
4342  i,Ox[i],Oy[i],Radius[i],Radius[i],i,i,i);
4343  }
4344 
4345 
4346 
4347 
4348 //------------------ plotting the track found
4349 
4350  i = nTracksFoundSoFar;
4351  if( Status != 99){
4352 
4353  rrr = sqrt( 0.25*ALFA[nTracksFoundSoFar]*ALFA[nTracksFoundSoFar] + 0.25*BETA[nTracksFoundSoFar]*BETA[nTracksFoundSoFar]
4354  -GAMMA[nTracksFoundSoFar]);
4355  alfa = ALFA[nTracksFoundSoFar]+2.*trajectory_vertex[0];
4356  beta = BETA[nTracksFoundSoFar]+2.*trajectory_vertex[1];
4357  cx = -0.5*alfa;
4358  cy = -0.5*beta;
4359  gamma = cx*cx+cy*cy-rrr*rrr;
4360 
4361  if(fabs(gamma) > 1.e-8){
4362  fprintf(MACRO, "TEllipse* FoundTrack%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nFoundTrack%d->SetLineColor(2);\n",
4363  i,cx/gamma,cy/gamma,rrr/fabs(gamma),rrr/fabs(gamma),i);
4364  fprintf(MACRO,"FoundTrack%d->SetFillStyle(0);\nFoundTrack%d->SetLineStyle(2);\nFoundTrack%d->SetLineWidth(1);\nFoundTrack%d->Draw();\n",
4365  i,i,i,i);
4366  } else {
4367  if( fabs(beta) > 1.e-8){
4368  yl = -xmin*alfa/beta-1./beta ;
4369  yu = -xmax*alfa/beta-1./beta ;
4370  fprintf(MACRO,"TLine* FoundTrack%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
4371  fprintf(MACRO,"FoundTrack%d->SetLineColor(2);\n",i);
4372  fprintf(MACRO,"FoundTrack%d->Draw();\n",i);
4373  } else {
4374  fprintf(MACRO,"TLine* FoundTrack%d = new TLine(%f,%f,%f,%f);\n",i,-1./alfa,ymin,-1./alfa,ymax);
4375  fprintf(MACRO,"FoundTrack%d->SetLineColor(2);\n",i);
4376  fprintf(MACRO,"FoundTrack%d->Draw();\n",i);
4377  }
4378  }
4379 
4380 
4381  } else {
4382 
4383  alfa = ALFA[nTracksFoundSoFar];
4384  beta = BETA[nTracksFoundSoFar];
4385  gamma = GAMMA[nTracksFoundSoFar]+ALFA[nTracksFoundSoFar]*trajectory_vertex[0]+BETA[nTracksFoundSoFar]*trajectory_vertex[1];
4386 
4387  if( fabs(beta) > 1.e-8){
4388  yl = -xmin*alfa/beta-1./beta ;
4389  yu = -xmax*alfa/beta-1./beta ;
4390  fprintf(MACRO,"TLine* FoundTrack%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
4391  fprintf(MACRO,"FoundTrack%d->SetLineColor(2);\n",i);
4392  fprintf(MACRO,"FoundTrack%d->Draw();\n",i);
4393  } else {
4394  fprintf(MACRO,"TLine* FoundTrack%d = new TLine(%f,%f,%f,%f);\n",i,-1./alfa,ymin,-1./alfa,ymax);
4395  fprintf(MACRO,"FoundTrack%d->SetLineColor(2);\n",i);
4396  fprintf(MACRO,"FoundTrack%d->Draw();\n",i);
4397  }
4398 
4399 
4400  }
4401 
4402 
4403 
4404 // ------------------------------
4405 
4406 // plotting all the tracks MC generated
4407 
4408 //cout<<" TRASLAZIONE IN "<<trajectory_vertex[0]<<", "<<trajectory_vertex[1]<<endl;
4409 
4410 
4411  Int_t icode;
4412  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica ;
4413  PndMCTrack* pMC;
4414  for(i=0;i<nMCTracks; i++){
4415  pMC = (PndMCTrack*) fMCTrackArray->At(i);
4416  if ( ! pMC ) continue;
4417  icode = pMC->GetPdgCode() ; // PDG code of track
4418  Oxx = pMC->GetStartVertex().X(); // X of starting point track
4419  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
4420  Px = pMC->GetMomentum().X();
4421  Py = pMC->GetMomentum().Y();
4422  aaa = sqrt( Px*Px + Py*Py);
4423  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
4424  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
4425  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
4426  if (icode>1000000000) carica = 1.;
4427  else carica = fParticle->Charge()/3. ; // charge of track
4428  if(fabs(carica)<0.1) continue;
4429  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
4430  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
4431 
4432 
4433 // for(i=0; i<nMCTracks; i++){
4434  cx = Cx - trajectory_vertex[0];
4435  cy = Cy - trajectory_vertex[1];
4436  gamma = -Rr*Rr + (cx*cx+cy*cy);
4437 
4438 
4439 
4440 
4441  if(fabs(gamma)< 0.001) {
4442 
4443  if(cy != 0.) {
4444  yl = xmin*(-cx/cy) + 0.5/cy;
4445  yu = xmax*(-cx/cy) + 0.5/cy;
4446  xl = xmin;
4447  xu = xmax;
4448  } else{
4449  yl = ymin;
4450  yu = ymax;
4451  xu=xl = 0.5/cx;
4452  }
4453  fprintf(MACRO,"TLine* MCris%d = new TLine(%f,%f,%f,%f);\n",i,xl,yl,xu,yu);
4454  fprintf(MACRO,"MCris%d->SetLineStyle(2);\n",i);
4455  fprintf(MACRO,"MCris%d->SetLineColor(3);\n",i);
4456  fprintf(MACRO,"MCris%d->SetLineWidth(1);\n",i);
4457  fprintf(MACRO,"MCris%d->Draw();\n",i);
4458 
4459  } else {
4460 
4461 
4462  if(fabs(Rr/gamma) > 1.) {
4463  if(fabs(Cy)>0.001 ) {
4464  yl = -xmin*Cx/Cy+0.5/Cy;
4465  yu = -xmax*Cx/Cy+0.5/Cy;
4466  fprintf(MACRO,"TLine* MCline%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
4467  fprintf(MACRO,"MCline%d->SetLineColor(3);\n",i);
4468  fprintf(MACRO,"MCline%d->Draw();\n",i);
4469  } else {
4470  fprintf(MACRO,"TLine* MCline%d = new TLine(%f,%f,%f,%f);\n",i,2.*CxMC[i],ymin,2.*CxMC[i],ymax);
4471  fprintf(MACRO,"MCline%d->SetLineColor(2);\n",i);
4472  fprintf(MACRO,"MCline%d->Draw();\n",i);
4473  }
4474  } else {
4475 
4476 
4477 
4478  fprintf(MACRO,
4479  "TEllipse* MCcerchio%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nMCcerchio%d->SetLineColor(3);\n",
4480  i,cx/gamma,cy/gamma,Rr/fabs(gamma),Rr/fabs(gamma),i);
4481  fprintf(MACRO,
4482  "MCcerchio%d->SetFillStyle(0);\nMCcerchio%d->SetLineStyle(2);\nMCcerchio%d->SetLineWidth(1);\nMCcerchio%d->Draw();\n",
4483  i,i,i,i);
4484 
4485  }
4486 
4487 
4488  }
4489 
4490 
4491  }
4492 
4493 
4494 
4495  fprintf(MACRO,"}\n");
4496  fclose(MACRO);
4497 
4498 
4499 
4500 
4501 
4502 
4503 
4504 
4505  return ;
4506 
4507 }
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
Double_t xmax
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
TVector3 offset(2, 0, 0)
Double_t CxMC[MAXTRACKSPEREVENT]
Double_t GAMMA[MAXTRACKSPEREVENT]
Int_t * fParticle
Definition: run_full.C:24
Double_t
const Double_t zpos
Double_t BETA[MAXTRACKSPEREVENT]
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
double dx
int cy
Definition: dedx_bands.C:17
static const Double_t CVEL
int cx
Definition: dedx_bands.C:16
Double_t xmin
Double_t ALFA[MAXTRACKSPEREVENT]
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
void PndSttTrackFinderReal::WriteMacroParallelHitsGeneral ( bool *  keepit,
Int_t  Nhits,
Double_t  info[][7],
Int_t  Nincl,
Int_t  Minclinations[],
Double_t  inclination[][3],
Short_t  nTracksFoundSoFar 
)
private

Definition at line 3350 of file PndSttTrackFinderReal.cxx.

References ALFA, angle, BETA, BFIELD, ccc, cos(), CVEL, disegnaAssiXY(), disegnaSciTilHit(), doMcComparison, Double_t, dx, dy, fabs(), fMCTrackArray, fParticle, GAMMA, PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), PndMCTrack::GetStartVertex(), i, istampa, IVOLTE, nFidivConformal, nmassimo, nmaxHits, nmaxSciTilHits, nMCTracks, nRdivConformalEffective, nSciTilHits, offset(), PI, posizSciTil, radiaConf, RMAXSCITIL, RStrawDetectorMax, RStrawDetectorMin, sin(), sqrt(), TypeConf, xmax, xmin, and zpos.

Referenced by DoFind().

3357 {
3358 
3359  Int_t i, j, i1, ii, index, Kincl, nlow, nup, STATUS;
3360 
3361  Double_t xmin , xmax, ymin, ymax, xl, xu, yl, yu,
3362  Ox[nmaxHits], Oy[nmaxHits], Radius[nmaxHits], gamma,
3363  dx, dy, diff, d1, d2,
3364  delta, deltax, deltay, deltaz, deltaS,
3365  factor,ff,
3366  zmin, zmax, Smin, Smax, S1, S2,
3367  z1, z2, y1, y2,x1,x2,
3368  vx1, vy1, vz1, C0x1, C0y1, C0z1,
3369  aaa, bbb, ccc, rrr, angle, minor, major,
3370  distance, Rx, Ry, LL,
3371  Aellipsis1, Bellipsis1,fi1,
3372  fmin, fmax, offset, step,
3373  SkewInclWithRespectToS, zpos, zpos1, zpos2,
3374  Tiltdirection1[2],
3375  zl[200],zu[200],
3376  POINTS1[6];
3377 
3378  char nome[300], nome2[300];
3379 
3380 
3381 
3382 
3383 //---------- parallel straws Macro now
3384  sprintf(nome,"MacroSttParEvent%d", IVOLTE);
3385  sprintf(nome2,"%s.C",nome);
3386  FILE * MACRO = fopen(nome2,"w");
3387  fprintf(MACRO,"void %s()\n{\n",nome);
3388  xmin=1.e20;
3389  xmax=-1.e20;
3390  ymin=1.e20;
3391  ymax=-1.e20;
3392 
3393 
3394 //--- SciTil info
3395  for( i=0; i< nSciTilHits; i++) {
3396  if (posizSciTil[i][0] < xmin) xmin = posizSciTil[i][0];
3397  if (posizSciTil[i][0] > xmax) xmax = posizSciTil[i][0];
3398  if (posizSciTil[i][1] < ymin) ymin = posizSciTil[i][1];
3399  if (posizSciTil[i][1] > ymax) ymax = posizSciTil[i][1];
3400  }
3401 //------
3402 
3403 
3404  for( i=0; i< Nhits; i++) {
3405  if( info[i][5] == 1 ) { // parallel straws
3406  if (info[i][0]-info[i][3] < xmin) xmin = info[i][0]-info[i][3];
3407  if (info[i][0]+info[i][3] > xmax) xmax = info[i][0]+info[i][3];
3408  if (info[i][1]-info[i][3] < ymin) ymin = info[i][1]-info[i][3];
3409  if (info[i][1]+info[i][3] > ymax) ymax = info[i][1]+info[i][3];
3410  }
3411  }
3412 
3413  if( xmin > 0. ) xmin = 0.;
3414  if( xmax < 0.) xmax = 0.;
3415  if( ymin > 0. ) ymin = 0.;
3416  if( ymax < 0.) ymax = 0.;
3417 
3418  deltax = xmax-xmin;
3419  deltay = ymax - ymin;
3420 
3421  if( deltax > deltay) {
3422  ymin -= 0.5*(deltax-deltay);
3423  ymax = ymin+ deltax;
3424  delta = deltax;
3425  } else {
3426  xmin -= 0.5*(deltay-deltax);
3427  xmax = xmin+ deltay;
3428  delta= deltay;
3429  }
3430 
3431  xmax = xmax + delta*0.15;
3432  xmin = xmin - delta*0.15;
3433 
3434  ymax = ymax + delta*0.15;
3435  ymin = ymin - delta*0.15;
3436 
3437 
3438  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
3439 
3440 
3441 
3442  disegnaAssiXY(MACRO,xmin,xmax,ymin,ymax);
3443 
3444 //---- disegna gli Scitil.
3445 
3446  for( i=0; i< nSciTilHits; i++) {
3447 
3448 
3450  MACRO,
3451  i,
3452  posizSciTil[i][0],
3453  posizSciTil[i][1],
3454  0
3455  );
3456 
3457 
3458 
3459 
3460  }
3461 //------------------------
3462 
3463  for( i=0; i< Nhits; i++) {
3464  if( info[i][5] == 1 ) { // parallel straws
3465  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);\nE%d->Draw();\n",
3466  i,info[i][0],info[i][1],info[i][3],info[i][3],i,i);
3467  }
3468  }
3469 
3470 
3471 
3472 
3473 //------------------------------- plotting all the tracks found
3474 
3475  for(i=0; i<nTracksFoundSoFar; i++){
3476  if(!keepit[i]) continue;
3477  if( TypeConf[i] ){
3478  aaa = -0.5*ALFA[i];
3479  bbb = -0.5*BETA[i];
3480 // Questa riga perche' so che la crf passa per origine
3481  rrr = sqrt( aaa*aaa+bbb*bbb);
3482 // rrr = sqrt( aaa*aaa+bbb*bbb-GAMMA[i]);
3483  fprintf(MACRO,
3484 "TEllipse* ris%d=new TEllipse(%f,%f,%f,%f,0.,360.);\nris%d->SetFillStyle(0);\nris%d->SetLineColor(2);\nris%d->Draw();\n",
3485  i,aaa,bbb,rrr,rrr,i,i,i);
3486 
3487  } else {
3488  if(fabs(BETA[i]) < 1.e-10){
3489 // fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,- GAMMA[i]/ALFA[i],ymin,- GAMMA[i]/ALFA[i],ymax);
3490  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,0.,ymin,0.,ymax);
3491  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3492  fprintf(MACRO,"ris%d->Draw();\n",i);
3493  } else {
3494  // yl = -xmin*ALFA[i]/BETA[i] - GAMMA[i]/BETA[i];
3495 // yu = -xmax*ALFA[i]/BETA[i] - GAMMA[i]/BETA[i];
3496  yl = -xmin*ALFA[i]/BETA[i];
3497  yu = -xmax*ALFA[i]/BETA[i];
3498  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
3499  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3500  fprintf(MACRO,"ris%d->Draw();\n",i);
3501  }
3502  }
3503 
3504 
3505 
3506 
3507 if(istampa>= 3 && IVOLTE <= nmassimo) {
3508  cout<<"stampa da WriteMacroParallelHitsGeneral , for trackfoundsofar n. "<<i<<", typconf "<<
3509  TypeConf[i]<<", nel normale piano XY; alfa "<<ALFA[i]<<", beta "<<BETA[i]<<", gamma "<<GAMMA[i]
3510  <<" a cui corrisponde Cx = "<<-0.5*ALFA[i]<<", Cy = "<<-0.5*BETA[i]<<" ed R = "
3511 // << sqrt( aaa*aaa+bbb*bbb-GAMMA[i]) <<endl;
3512  << sqrt( aaa*aaa+bbb*bbb) <<endl;
3513 }
3514 
3515 
3516 
3517 
3518  }
3519 
3520 // -----------
3521 
3522 
3523 
3524  fprintf(MACRO,"}\n");
3525  fclose(MACRO);
3526 
3527 //------------------------------------------------------------------------------------------------------------
3528 
3529 
3530 //---------- parallel straws Macro now con anche le tracce MC
3531 
3532 
3533 
3534  if(doMcComparison) {
3535 
3536 
3537  sprintf(nome,"MacroSttParwithMCEvent%d", IVOLTE);
3538  sprintf(nome2,"%s.C",nome);
3539  MACRO = fopen(nome2,"w");
3540  fprintf(MACRO,"void %s()\n{\n",nome);
3541  xmin=1.e20;
3542  xmax=-1.e20;
3543  ymin=1.e20;
3544  ymax=-1.e20;
3545 
3546 //--- SciTil info
3547  for( i=0; i< nSciTilHits; i++) {
3548  if (posizSciTil[i][0] < xmin) xmin = posizSciTil[i][0];
3549  if (posizSciTil[i][0] > xmax) xmax = posizSciTil[i][0];
3550  if (posizSciTil[i][1] < ymin) ymin = posizSciTil[i][1];
3551  if (posizSciTil[i][1] > ymax) ymax = posizSciTil[i][1];
3552  }
3553 //------
3554 
3555  for( i=0; i< Nhits; i++) {
3556  if( info[i][5] == 1 ) { // parallel straws
3557  if (info[i][0]-info[i][3] < xmin) xmin = info[i][0]-info[i][3];
3558  if (info[i][0]+info[i][3] > xmax) xmax = info[i][0]+info[i][3];
3559  if (info[i][1]-info[i][3] < ymin) ymin = info[i][1]-info[i][3];
3560  if (info[i][1]+info[i][3] > ymax) ymax = info[i][1]+info[i][3];
3561  }
3562  }
3563 
3564  if( xmin > 0. ) xmin = 0.;
3565  if( xmax < 0.) xmax = 0.;
3566  if( ymin > 0. ) ymin = 0.;
3567  if( ymax < 0.) ymax = 0.;
3568 
3569  deltax = xmax-xmin;
3570  deltay = ymax - ymin;
3571 
3572  if( deltax > deltay) {
3573  ymin -= 0.5*(deltax-deltay);
3574  ymax = ymin+ deltax;
3575  delta = deltax;
3576  } else {
3577  xmin -= 0.5*(deltay-deltax);
3578  xmax = xmin+ deltay;
3579  delta= deltay;
3580  }
3581 
3582  xmax = xmax + delta*0.15;
3583  xmin = xmin - delta*0.15;
3584 
3585  ymax = ymax + delta*0.15;
3586  ymin = ymin - delta*0.15;
3587 
3588 
3589  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
3590 
3591 
3592 
3593  disegnaAssiXY(MACRO,xmin,xmax,ymin,ymax);
3594 
3595 
3596 //---- disegna gli Scitil.
3597 
3598  for( i=0; i< nSciTilHits; i++) {
3599 /*
3600  fprintf(MACRO,"TMarker* SciT%d = new TMarker(%f,%f,%d);\n",
3601  i,posizSciTil[i][0],posizSciTil[i][1],30);
3602  fprintf(MACRO,"SciT%d->SetMarkerSize(1.5);\n",i);
3603  fprintf(MACRO,"SciT%d->SetMarkerColor(1);\nSciT%d->Draw();\n"
3604  ,i,i);
3605 */
3607  MACRO,
3608  i,
3609  posizSciTil[i][0],
3610  posizSciTil[i][1],
3611  0
3612  );
3613 
3614  }
3615 //------------------------
3616 
3617  for( i=0; i< Nhits; i++) {
3618  if( info[i][5] == 1 ) { // parallel straws
3619  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);\nE%d->Draw();\n",
3620  i,info[i][0],info[i][1],info[i][3],info[i][3],i,i);
3621  }
3622  }
3623 
3624 //--------------------------- ora le tracce MC
3625  Int_t icode;
3626  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica ;
3627  PndMCTrack* pMC;
3628  for(int im=0;im<nMCTracks; im++){
3629  pMC = (PndMCTrack*) fMCTrackArray->At(im);
3630  if ( ! pMC ) continue;
3631  icode = pMC->GetPdgCode() ; // PDG code of track
3632  Oxx = pMC->GetStartVertex().X(); // X of starting point track
3633  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
3634  Px = pMC->GetMomentum().X();
3635  Py = pMC->GetMomentum().Y();
3636  aaa = sqrt( Px*Px + Py*Py);
3637  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
3638  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
3639  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
3640  if (icode>1000000000) carica = 1.;
3641  else carica = fParticle->Charge()/3. ; // charge of track
3642  if( fabs(carica)<0.1) continue;
3643  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
3644  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
3645  fprintf(MACRO,"TEllipse* MC%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nMC%d->SetFillStyle(0);\nMC%d->SetLineColor(3);\nMC%d->Draw();\n",
3646  im,Cx,Cy,Rr,Rr,im,im,im);
3647  } // end of for(int im=0;im<nMCTracks; im++)
3648 
3649 //----------- fine parte del MC
3650 
3651 //------------------------------- plotting all the tracks found
3652 
3653  for(i=0; i<nTracksFoundSoFar; i++){
3654  if(!keepit[i]) continue;
3655 
3656  if( TypeConf[i] ){
3657  aaa = -0.5*ALFA[i];
3658  bbb = -0.5*BETA[i];
3659  rrr = sqrt( aaa*aaa+bbb*bbb-GAMMA[i]);
3660  fprintf(MACRO,"TEllipse* ris%d=new TEllipse(%f,%f,%f,%f,0.,360.);\nris%d->SetFillStyle(0);\nris%d->SetLineColor(2);\nris%d->Draw();\n",
3661  i,aaa,bbb,rrr,rrr,i,i,i);
3662  } else {
3663  if(fabs(BETA[i]) < 1.e-10){
3664  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,- GAMMA[i]/ALFA[i],ymin,- GAMMA[i]/ALFA[i],ymax);
3665  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3666  fprintf(MACRO,"ris%d->Draw();\n",i);
3667  } else {
3668  yl = -xmin*ALFA[i]/BETA[i] - GAMMA[i]/BETA[i];
3669  yu = -xmax*ALFA[i]/BETA[i] - GAMMA[i]/BETA[i];
3670  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
3671  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3672  fprintf(MACRO,"ris%d->Draw();\n",i);
3673  }
3674  }
3675 
3676 
3677  }
3678 
3679 // -----------
3680 
3681  fprintf(MACRO,"}\n");
3682  fclose(MACRO);
3683 
3684 
3685  } // end of if(doMcComparison)
3686 //------------------------------------------------------------------------------------------------------------
3687 
3688 // ora riplotto tutto nello spazio conforme usando la trasformazione u= x/(x**2+y**2) e v = y/(x**2+y**2)
3689 //
3690 // aggiungo anche la grigliatura dello spazio conforme usata per la box del pattern recognition
3691 
3692  sprintf(nome,"MacroSttParConformeEvent%d", IVOLTE);
3693  sprintf(nome2,"%s.C",nome);
3694  MACRO = fopen(nome2,"w");
3695  fprintf(MACRO,"void %s()\n{\n",nome);
3696  xmin=1.e20;
3697  xmax=-1.e20;
3698  ymin=1.e20;
3699  ymax=-1.e20;
3700 
3701 
3702 //--- SciTil info
3703  Double_t USciTil[nmaxSciTilHits],
3704  VSciTil[nmaxSciTilHits];
3705  for( i=0; i< nSciTilHits; i++) {
3706  Double_t erre = posizSciTil[i][0]*posizSciTil[i][0]+
3707  posizSciTil[i][1]*posizSciTil[i][1];
3708  USciTil[i] = posizSciTil[i][0]/erre;
3709  VSciTil[i] = posizSciTil[i][1]/erre;
3710  if (USciTil[i] < xmin) xmin = USciTil[i];
3711  if (USciTil[i] > xmax) xmax = USciTil[i];
3712  if (VSciTil[i] < ymin) ymin = VSciTil[i];
3713  if (VSciTil[i] > ymax) ymax = VSciTil[i];
3714  }
3715 //------
3716 
3717 
3718 
3719  for( i=0; i< Nhits; i++) {
3720  if( info[i][5] == 1 ) { // parallel straws
3721 // centro sfera in sistema conforme
3722  gamma = info[i][0]*info[i][0] + info[i][1]*info[i][1] - info[i][3]*info[i][3];
3723  Ox[i] = info[i][0] / gamma;
3724  Oy[i] = info[i][1] / gamma;
3725  Radius[i] = info[i][3]/gamma;
3726  if (Ox[i]-Radius[i] < xmin) xmin = Ox[i]-Radius[i];
3727  if (Ox[i]+Radius[i] > xmax) xmax = Ox[i]+Radius[i];
3728  if (Oy[i]-Radius[i] < ymin) ymin = Oy[i]-Radius[i];
3729  if (Oy[i]+Radius[i] > ymax) ymax = Oy[i]+Radius[i];
3730  }
3731  }
3732 
3733  if( xmin > 0. ) xmin = 0.;
3734  if( xmax < 0.) xmax = 0.;
3735  if( ymin > 0. ) ymin = 0.;
3736  if( ymax < 0.) ymax = 0.;
3737 
3738  deltax = xmax-xmin;
3739  deltay = ymax - ymin;
3740 
3741  if( deltax > deltay) {
3742  ymin -= 0.5*(deltax-deltay);
3743  ymax = ymin+ deltax;
3744  delta = deltax;
3745  } else {
3746  xmin -= 0.5*(deltay-deltax);
3747  xmax = xmin+ deltay;
3748  delta= deltay;
3749  }
3750 
3751  xmax = xmax + delta*0.15;
3752  xmin = xmin - delta*0.15;
3753 
3754  ymax = ymax + delta*0.15;
3755  ymin = ymin - delta*0.15;
3756 
3757 
3758  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
3759 
3760 // ora la grigliatura con i cerchi
3761 
3762  fprintf(MACRO,"TEllipse* Griglia%d = new TEllipse(0.,0.,%f,%f,0.,360.);\nGriglia%d->SetLineColor(4);\nGriglia%d->Draw();\n",
3764 
3765  for( i=nRdivConformalEffective-1; i>=0 ; i--) {
3766  fprintf(MACRO,"TEllipse* Griglia%d = new TEllipse(0.,0.,%f,%f,0.,360.);\nGriglia%d->SetLineColor(4);\nGriglia%d->Draw();\n",
3767  i,radiaConf[i],radiaConf[i],i,i);
3768  }
3769 //---------------------
3770 // ora la grigliatura con i segmenti blu per delimitare la zona degli Stt.
3771 
3772  for(i=0; i<nFidivConformal; i++) {
3773  ff = i*2.*PI/nFidivConformal;
3774  x1=cos(ff)/RStrawDetectorMax;
3775  y1=sin(ff)/RStrawDetectorMax;
3776  x2=cos(ff)/RStrawDetectorMin;
3777  y2=sin(ff)/RStrawDetectorMin;
3778  fprintf(MACRO,"TLine* Seg%d = new TLine(%f,%f,%f,%f);\nSeg%d->SetLineColor(4);\nSeg%d->Draw();\n",
3779  i,x1,y1,x2,y2,i,i);
3780  }
3781 //---------------------
3782 // ora la grigliatura con i segmenti magenta per comprendere la zona degli SciTil.
3783 
3784  for(i=0; i<nFidivConformal; i++) {
3785  ff = i*2.*PI/nFidivConformal;
3786  x1=cos(ff)/RMAXSCITIL;
3787  y1=sin(ff)/RMAXSCITIL;
3788  x2=cos(ff)/RStrawDetectorMax;
3789  y2=sin(ff)/RStrawDetectorMax;
3790  fprintf(MACRO,"TLine* Seg%d = new TLine(%f,%f,%f,%f);\nSeg%d->SetLineColor(6);\nSeg%d->Draw();\n",
3791  i,x1,y1,x2,y2,i,i);
3792  }
3793 //---------------------
3794 
3795  fprintf(MACRO,"TGaxis *Assex = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",xmin,0.,xmax,0.,xmin,xmax);
3796  fprintf(MACRO,"Assex->SetTitle(\"U \");\n");
3797  fprintf(MACRO,"Assex->SetTitleOffset(1.5);\n");
3798  fprintf(MACRO,"Assex->Draw();\n");
3799  fprintf(MACRO,"TGaxis *Assey = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n", 0.,ymin,0.,ymax,ymin,ymax);
3800  fprintf(MACRO,"Assey->SetTitle(\"V \");\n");
3801  fprintf(MACRO,"Assey->SetTitleOffset(1.5);\n");
3802  fprintf(MACRO,"Assey->Draw();\n");
3803 
3804 
3805 // plot degli Hits Stt.
3806  for( i=0; i< Nhits; i++) {
3807  if( info[i][5] == 1 ) { // parallel straws
3808  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);\nE%d->Draw();\n",
3809  i,Ox[i],Oy[i],Radius[i],Radius[i],i,i);
3810  }
3811  }
3812 
3813 // plot degli Hit SciTil
3814  for( i=0; i< nSciTilHits; i++) {
3815 
3816 
3818  MACRO,
3819  i,
3820  posizSciTil[i][0],
3821  posizSciTil[i][1],
3822  2 // 2--> disegno SciTil in conforme.
3823  );
3824 /*
3825  fprintf(MACRO,"TMarker* SciT%d = new TMarker(%f,%f,%d);\n",
3826  i,USciTil[i],VSciTil[i],30);
3827  fprintf(MACRO,"SciT%d->SetMarkerSize(1.1);\n",i);
3828  fprintf(MACRO,"SciT%d->SetMarkerColor(1);\nSciT%d->Draw();\n"
3829  ,i,i);
3830 */
3831 
3832  }
3833 
3834 
3835 
3836 
3837 //------------------ plotting all the tracks found
3838 
3839  for(i=0; i<nTracksFoundSoFar; i++){
3840  if(!keepit[i]) continue;
3841 
3842 
3843 // cout<<" da writeparallelhitsgeneral, traccia found n. "<<i<<", typeconf "<<TypeConf[i]
3844 // <<", alfa "<<ALFA[i]<<", beta "<<BETA[i]<<", gamma "<<GAMMA[i]<<endl;
3845 
3846 // assumo che tutte le traiettorie siano rette nello spazio conforme, perche' le tracce vengono dal vertice primario
3847 
3848  if( TypeConf[i] ){
3849 
3850 
3851  if(fabs(BETA[i]) < 1.e-10){
3852  if(fabs(ALFA[i])<1.e-10) {
3853  continue;
3854  } else {
3855  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,-1./ALFA[i],ymin,- 1./ALFA[i],ymax);
3856  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3857  fprintf(MACRO,"ris%d->Draw();\n",i);
3858  }
3859  } else {
3860  yl = -xmin*ALFA[i]/BETA[i] - 1./BETA[i];
3861  yu = -xmax*ALFA[i]/BETA[i] - 1./BETA[i];
3862  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
3863  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3864  fprintf(MACRO,"ris%d->Draw();\n",i);
3865  }
3866 
3867 
3868  } else { // in this case TypConf = 0 --> straight line in XY
3869 
3870 
3871  if( fabs(GAMMA[i]) > 1.e-10) {
3872  aaa = -0.5*ALFA[i]/GAMMA[i];
3873  bbb = -0.5*BETA[i]/GAMMA[i];
3874  rrr = sqrt( aaa*aaa+bbb*bbb);
3875  fprintf(MACRO,"TEllipse* ris%d=new TEllipse(%f,%f,%f,%f,0.,360.);\nris%d->SetFillStyle(0);\nris%d->SetLineColor(2);\nris%d->Draw();\n",
3876  i,aaa,bbb,rrr,rrr,i,i,i);
3877  } else {
3878  if(fabs(BETA[i])>1.e-10) {
3879  yl = -xmin*ALFA[i]/BETA[i] ;
3880  yu = -xmax*ALFA[i]/BETA[i] ;
3881  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
3882  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3883  fprintf(MACRO,"ris%d->Draw();\n",i);
3884  } else {
3885  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,0.,ymin,0.,ymax);
3886  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
3887  fprintf(MACRO,"ris%d->Draw();\n",i);
3888  }
3889  }
3890 
3891  }
3892  }
3893 
3894 // ------------------------------
3895 
3896  fprintf(MACRO,"}\n");
3897  fclose(MACRO);
3898 
3899 
3900  return ;
3901 
3902 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t posizSciTil[nmaxSciTilHits][3]
Double_t xmax
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
static const Double_t RStrawDetectorMin
TVector3 offset(2, 0, 0)
void disegnaAssiXY(FILE *MACRO, double xmin, double xmax, double ymin, double ymax)
Double_t GAMMA[MAXTRACKSPEREVENT]
Int_t * fParticle
Definition: run_full.C:24
static const Short_t nmaxSciTilHits
Double_t
const Double_t zpos
Double_t BETA[MAXTRACKSPEREVENT]
static const Short_t nFidivConformal
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
double dx
static const Double_t PI
Double_t radiaConf[nRdivConformal]
void disegnaSciTilHit(FILE *MACRO, int ScitilHit, double posx, double posy, int tipo)
static const Double_t CVEL
Double_t xmin
bool TypeConf[MAXTRACKSPEREVENT]
Double_t ALFA[MAXTRACKSPEREVENT]
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
static const Double_t RStrawDetectorMax
static const Double_t RMAXSCITIL
void PndSttTrackFinderReal::WriteMacroParallelHitsGeneralConformalwithMC ( bool *  keepit,
Int_t  Nhits,
Double_t  info[][7],
Int_t  Nincl,
Int_t  Minclinations[],
Double_t  inclination[][3],
Short_t  nTracksFoundSoFar 
)
private

Definition at line 3912 of file PndSttTrackFinderReal.cxx.

References ALFA, angle, BETA, BFIELD, ccc, cos(), CVEL, CxMC, disegnaSciTilHit(), Double_t, dx, dy, fabs(), fMCTrackArray, fParticle, GAMMA, PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), PndMCTrack::GetStartVertex(), i, IVOLTE, nFidivConformal, nmaxHits, nmaxSciTilHits, nMCTracks, nRdivConformalEffective, nSciTilHits, offset(), PI, posizSciTil, radiaConf, RMAXSCITIL, RStrawDetectorMax, RStrawDetectorMin, sin(), sqrt(), TypeConf, xmax, xmin, and zpos.

Referenced by DoFind().

3920 {
3921 
3922  Int_t i, j, i1, ii, index, Kincl, nlow, nup, STATUS;
3923 
3924  Double_t xmin , xmax, ymin, ymax, xl, xu, yl, yu, rrr,
3925  Ox[nmaxHits], Oy[nmaxHits], Radius[nmaxHits], gamma,
3926  dx, dy, diff, d1, d2,
3927  delta, deltax, deltay, deltaz, deltaS,
3928  factor,ff,
3929  zmin, zmax, Smin, Smax, S1, S2,
3930  z1, z2, y1, y2,x1,x2,
3931  vx1, vy1, vz1, C0x1, C0y1, C0z1,
3932  aaa, bbb, ccc, angle, minor, major,
3933  distance, Rx, Ry, LL,
3934  Aellipsis1, Bellipsis1,fi1,
3935  fmin, fmax, offset, step,
3936  SkewInclWithRespectToS, zpos, zpos1, zpos2,
3937  zl[200],zu[200];
3938 
3939  Double_t USciTil[nmaxSciTilHits],
3940  VSciTil[nmaxSciTilHits];
3941 
3942 //---------- parallel straws Macro now
3943  char nome[300], nome2[300];
3944  FILE * MACRO;
3945 
3946 
3947 // ora riplotto tutto nello spazio conforme usando la trasformazione u= x/(x**2+y**2) e v = y/(x**2+y**2)
3948 //
3949 // aggiungo anche la grigliatura dello spazio conforme usata per la box del pattern recognition
3950 
3951  sprintf(nome,"MacroSttParConformewithMCEvent%d", IVOLTE);
3952  sprintf(nome2,"%s.C",nome);
3953  MACRO = fopen(nome2,"w");
3954  fprintf(MACRO,"void %s()\n{\n",nome);
3955  xmin=1.e20;
3956  xmax=-1.e20;
3957  ymin=1.e20;
3958  ymax=-1.e20;
3959 
3960 
3961 //--- SciTil info
3962  for( i=0; i< nSciTilHits; i++) {
3963  Double_t erre = posizSciTil[i][0]*posizSciTil[i][0]+
3964  posizSciTil[i][1]*posizSciTil[i][1];
3965  USciTil[i] = posizSciTil[i][0]/erre;
3966  VSciTil[i] = posizSciTil[i][1]/erre;
3967  if (USciTil[i] < xmin) xmin = USciTil[i];
3968  if (USciTil[i] > xmax) xmax = USciTil[i];
3969  if (VSciTil[i] < ymin) ymin = VSciTil[i];
3970  if (VSciTil[i] > ymax) ymax = VSciTil[i];
3971  }
3972 //------
3973 
3974  for( i=0; i< Nhits; i++) {
3975  if( info[i][5] == 1 ) { // parallel straws
3976 // centro sfera in sistema conforme
3977  gamma = info[i][0]*info[i][0] + info[i][1]*info[i][1] - info[i][3]*info[i][3];
3978  Ox[i] = info[i][0] / gamma;
3979  Oy[i] = info[i][1] / gamma;
3980  Radius[i] = info[i][3]/gamma;
3981  if (Ox[i]-Radius[i] < xmin) xmin = Ox[i]-Radius[i];
3982  if (Ox[i]+Radius[i] > xmax) xmax = Ox[i]+Radius[i];
3983  if (Oy[i]-Radius[i] < ymin) ymin = Oy[i]-Radius[i];
3984  if (Oy[i]+Radius[i] > ymax) ymax = Oy[i]+Radius[i];
3985  }
3986  }
3987 
3988  if( xmin > 0. ) xmin = 0.;
3989  if( xmax < 0.) xmax = 0.;
3990  if( ymin > 0. ) ymin = 0.;
3991  if( ymax < 0.) ymax = 0.;
3992 
3993  deltax = xmax-xmin;
3994  deltay = ymax - ymin;
3995 
3996  if( deltax > deltay) {
3997  ymin -= 0.5*(deltax-deltay);
3998  ymax = ymin+ deltax;
3999  delta = deltax;
4000  } else {
4001  xmin -= 0.5*(deltay-deltax);
4002  xmax = xmin+ deltay;
4003  delta= deltay;
4004  }
4005 
4006  xmax = xmax + delta*0.15;
4007  xmin = xmin - delta*0.15;
4008 
4009  ymax = ymax + delta*0.15;
4010  ymin = ymin - delta*0.15;
4011 
4012 
4013  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
4014 
4015 // ora la grigliatura con i cerchi
4016 
4017  fprintf(MACRO,"TEllipse* Griglia%d = new TEllipse(0.,0.,%f,%f,0.,360.);\nGriglia%d->SetLineColor(4);\nGriglia%d->Draw();\n",
4019 
4020  for( i=nRdivConformalEffective-1; i>=0 ; i--) {
4021  fprintf(MACRO,"TEllipse* Griglia%d = new TEllipse(0.,0.,%f,%f,0.,360.);\nGriglia%d->SetLineColor(4);\nGriglia%d->Draw();\n",
4022  i,radiaConf[i],radiaConf[i],i,i);
4023  }
4024 //---------------------
4025 // ora la grigliatura con i segmenti blu per delimitare la zona degli Stt.
4026 
4027  for(i=0; i<nFidivConformal; i++) {
4028  ff = i*2.*PI/nFidivConformal;
4029  x1=cos(ff)/RStrawDetectorMax;
4030  y1=sin(ff)/RStrawDetectorMax;
4031  x2=cos(ff)/RStrawDetectorMin;
4032  y2=sin(ff)/RStrawDetectorMin;
4033  fprintf(MACRO,"TLine* Seg%d = new TLine(%f,%f,%f,%f);\nSeg%d->SetLineColor(4);\nSeg%d->Draw();\n",
4034  i,x1,y1,x2,y2,i,i);
4035  }
4036 //---------------------
4037 // ora la grigliatura con i segmenti magenta per comprendere la zona degli SciTil.
4038 
4039  for(i=0; i<nFidivConformal; i++) {
4040  ff = i*2.*PI/nFidivConformal;
4041  x1=cos(ff)/RMAXSCITIL;
4042  y1=sin(ff)/RMAXSCITIL;
4043  x2=cos(ff)/RStrawDetectorMax;
4044  y2=sin(ff)/RStrawDetectorMax;
4045  fprintf(MACRO,"TLine* Seg%d = new TLine(%f,%f,%f,%f);\nSeg%d->SetLineColor(6);\nSeg%d->Draw();\n",
4046  i,x1,y1,x2,y2,i,i);
4047  }
4048 //---------------------
4049 
4050  fprintf(MACRO,"TGaxis *Assex = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",xmin,0.,xmax,0.,xmin,xmax);
4051  fprintf(MACRO,"Assex->SetTitle(\"U \");\n");
4052  fprintf(MACRO,"Assex->SetTitleOffset(1.5);\n");
4053  fprintf(MACRO,"Assex->Draw();\n");
4054  fprintf(MACRO,"TGaxis *Assey = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n", 0.,ymin,0.,ymax,ymin,ymax);
4055  fprintf(MACRO,"Assey->SetTitle(\"V \");\n");
4056  fprintf(MACRO,"Assey->SetTitleOffset(1.5);\n");
4057  fprintf(MACRO,"Assey->Draw();\n");
4058 
4059 // plot degli Hits Stt
4060  for( i=0; i< Nhits; i++) {
4061  if( info[i][5] == 1 ) { // parallel straws
4062 fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetLineWidth(2);\nE%d->SetFillStyle(0);\nE%d->Draw();\n",
4063  i,Ox[i],Oy[i],Radius[i],Radius[i],i,i,i);
4064  }
4065  }
4066 
4067 // plot degli Hit SciTil
4068  for( i=0; i< nSciTilHits; i++) {
4069 
4071  MACRO,
4072  i,
4073  posizSciTil[i][0],
4074  posizSciTil[i][1],
4075  2 // 2--> disegno SciTil in conforme.
4076  );
4077 /*
4078  fprintf(MACRO,"TMarker* SciT%d = new TMarker(%f,%f,%d);\n",
4079  i,USciTil[i],VSciTil[i],30);
4080  fprintf(MACRO,"SciT%d->SetMarkerSize(1.1);\n",i);
4081  fprintf(MACRO,"SciT%d->SetMarkerColor(1);\nSciT%d->Draw();\n"
4082  ,i,i);
4083 */
4084  }
4085 
4086 //------------------ plotting all the tracks found
4087 
4088  for(i=0; i<nTracksFoundSoFar; i++){
4089  if(!keepit[i]) continue;
4090 
4091  if( TypeConf[i] ){
4092 
4093  if( fabs(GAMMA[i]) > 1.e-10) {
4094  aaa = -0.5*ALFA[i]/GAMMA[i];
4095  bbb = -0.5*BETA[i]/GAMMA[i];
4096  rrr = sqrt( aaa*aaa+bbb*bbb-1./GAMMA[i]);
4097  if( fabs(rrr/GAMMA[i]) < 30.) {
4098  fprintf(MACRO,
4099 "TEllipse* ris%d=new TEllipse(%f,%f,%f,%f,0.,360.);\nris%d->SetFillStyle(0);\nris%d->SetLineColor(2);\nris%d->Draw();\n",
4100  i,aaa,bbb,rrr,rrr,i,i,i);
4101  } else{
4102 
4103 
4104  yl = -xmin*ALFA[i]/BETA[i] - 1./BETA[i];
4105  yu = -xmax*ALFA[i]/BETA[i] - 1./BETA[i];
4106  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
4107  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
4108  fprintf(MACRO,"ris%d->Draw();\n",i);
4109 
4110 
4111 
4112  }
4113  } else {
4114 
4115  if(fabs(BETA[i]) < 1.e-10){
4116  if(fabs(ALFA[i])<1.e-10) {
4117  continue;
4118  } else {
4119  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,-1./ALFA[i],ymin,- 1./ALFA[i],ymax);
4120  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
4121  fprintf(MACRO,"ris%d->Draw();\n",i);
4122  }
4123  } else {
4124  yl = -xmin*ALFA[i]/BETA[i] - 1./BETA[i];
4125  yu = -xmax*ALFA[i]/BETA[i] - 1./BETA[i];
4126  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
4127  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
4128  fprintf(MACRO,"ris%d->Draw();\n",i);
4129  }
4130 
4131  }
4132 
4133  } else { // in this case TypConf = 0 --> straight line in XY
4134 
4135 
4136  if( fabs(GAMMA[i]) > 1.e-10) {
4137  aaa = -0.5*ALFA[i]/GAMMA[i];
4138  bbb = -0.5*BETA[i]/GAMMA[i];
4139  rrr = sqrt( aaa*aaa+bbb*bbb);
4140  fprintf(MACRO,"TEllipse* ris%d=new TEllipse(%f,%f,%f,%f,0.,360.);\nris%d->SetFillStyle(0);\nris%d->SetLineColor(2);\nris%d->Draw();\n",
4141  i,aaa,bbb,rrr,rrr,i,i,i);
4142  } else {
4143  if(fabs(BETA[i])>1.e-10) {
4144  yl = -xmin*ALFA[i]/BETA[i] ;
4145  yu = -xmax*ALFA[i]/BETA[i] ;
4146  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
4147  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
4148  fprintf(MACRO,"ris%d->Draw();\n",i);
4149  } else {
4150  fprintf(MACRO,"TLine* ris%d = new TLine(%f,%f,%f,%f);\n",i,0.,ymin,0.,ymax);
4151  fprintf(MACRO,"ris%d->SetLineColor(2);\n",i);
4152  fprintf(MACRO,"ris%d->Draw();\n",i);
4153  }
4154  }
4155 
4156  }
4157  }
4158 
4159 // ------------------------------
4160 
4161 // plotting all the tracks MC generated
4162 
4163 
4164 
4165  Int_t icode;
4166  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica ;
4167  PndMCTrack* pMC;
4168  for(i=0;i<nMCTracks; i++){
4169  pMC = (PndMCTrack*) fMCTrackArray->At(i);
4170  if ( ! pMC ) continue;
4171  icode = pMC->GetPdgCode() ; // PDG code of track
4172  Oxx = pMC->GetStartVertex().X(); // X of starting point track
4173  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
4174  Px = pMC->GetMomentum().X();
4175  Py = pMC->GetMomentum().Y();
4176  aaa = sqrt( Px*Px + Py*Py);
4177  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
4178  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
4179  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
4180  if (icode>1000000000) carica = 1.;
4181  else carica = fParticle->Charge()/3. ; // charge of track
4182  if (fabs(carica)<0.1 ) continue;
4183  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
4184  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
4185  gamma = -Rr*Rr + Cx*Cx+Cy*Cy;
4186  if(fabs(gamma)< 0.001) {
4187  if(Cy != 0.) {
4188  yl = xmin*(-Cx/Cy) + 0.5/Cy;
4189  yu = xmax*(-Cx/Cy) + 0.5/Cy;
4190  xl = xmin;
4191  xu = xmax;
4192  } else {
4193  yl = ymin;
4194  yu = ymax;
4195  xu=xl = 0.5/Cx;
4196  }
4197  fprintf(MACRO,"TLine* MCris%d = new TLine(%f,%f,%f,%f);\n",i,xl,yl,xu,yu);
4198  fprintf(MACRO,"MCris%d->SetLineStyle(2);\n",i);
4199  fprintf(MACRO,"MCris%d->SetLineColor(3);\n",i);
4200  fprintf(MACRO,"MCris%d->SetLineWidth(1);\n",i);
4201  fprintf(MACRO,"MCris%d->Draw();\n",i);
4202 
4203  } else {
4204  if(fabs(Rr/gamma) > 1.) {
4205  if(fabs(Cy)>0.001 ) {
4206  yl = -xmin*Cx/Cy+0.5/Cy;
4207  yu = -xmax*Cx/Cy+0.5/Cy;
4208  fprintf(MACRO,"TLine* MCline%d = new TLine(%f,%f,%f,%f);\n",i,xmin,yl,xmax,yu);
4209  fprintf(MACRO,"MCline%d->SetLineColor(3);\n",i);
4210  fprintf(MACRO,"MCline%d->Draw();\n",i);
4211  } else {
4212  fprintf(MACRO,"TLine* MCline%d = new TLine(%f,%f,%f,%f);\n",i,2.*CxMC[i],ymin,2.*CxMC[i],ymax);
4213  fprintf(MACRO,"MCline%d->SetLineColor(2);\n",i);
4214  fprintf(MACRO,"MCline%d->Draw();\n",i);
4215  }
4216  } else {
4217  fprintf(MACRO, "TEllipse* MCcerchio%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nMCcerchio%d->SetLineColor(3);\n",
4218  i,Cx/gamma,Cy/gamma,Rr/fabs(gamma),Rr/fabs(gamma),i);
4219 
4220  fprintf(MACRO,"MCcerchio%d->SetFillStyle(0);\nMCcerchio%d->SetLineStyle(2);\nMCcerchio%d->SetLineWidth(1);\nMCcerchio%d->Draw();\n",
4221  i,i,i,i);
4222  }
4223  }
4224  } // end of for(i=0;i<nMCTracks; i++)
4225 
4226 
4227 
4228  fprintf(MACRO,"}\n");
4229  fclose(MACRO);
4230 
4231 
4232  return ;
4233 
4234 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t posizSciTil[nmaxSciTilHits][3]
Double_t xmax
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
static const Double_t RStrawDetectorMin
TVector3 offset(2, 0, 0)
Double_t CxMC[MAXTRACKSPEREVENT]
Double_t GAMMA[MAXTRACKSPEREVENT]
Int_t * fParticle
Definition: run_full.C:24
static const Short_t nmaxSciTilHits
Double_t
const Double_t zpos
Double_t BETA[MAXTRACKSPEREVENT]
static const Short_t nFidivConformal
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
double dx
static const Double_t PI
Double_t radiaConf[nRdivConformal]
void disegnaSciTilHit(FILE *MACRO, int ScitilHit, double posx, double posy, int tipo)
static const Double_t CVEL
Double_t xmin
bool TypeConf[MAXTRACKSPEREVENT]
Double_t ALFA[MAXTRACKSPEREVENT]
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
static const Double_t RStrawDetectorMax
static const Double_t RMAXSCITIL
void PndSttTrackFinderReal::WriteMacroParallelHitswithRfromMC ( Int_t  Nhits,
Double_t  info[][7],
Short_t  nTracksFoundSoFar,
Double_t Ox,
Double_t Oy,
Short_t *  daParTrackFoundaTrackMC 
)
private

Definition at line 10173 of file PndSttTrackFinderReal.cxx.

References angle, atan2(), BFIELD, ccc, cos(), CVEL, disegnaAssiXY(), Double_t, dx, dy, fabs(), fMCTrackArray, fParticle, PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), PndMCTrack::GetStartVertex(), i, IVOLTE, nMCTracks, offset(), PI, sin(), sqrt(), xmax, xmin, and zpos.

10181 {
10182 
10183  Int_t i, j, i1, ii, index, Kincl, nlow, nup, STATUS;
10184 
10185  Double_t xmin , xmax, ymin, ymax, xl, xu, yl, yu,
10186  gamma,
10187  dx, dy, diff, d1, d2,
10188  delta, deltax, deltay, deltaz, deltaS,
10189  factor,ff,
10190  zmin, zmax, Smin, Smax, S1, S2,
10191  z1, z2, y1, y2,x1,x2,
10192  vx1, vy1, vz1, C0x1, C0y1, C0z1,
10193  aaa, bbb, ccc, rrr, angle, minor, major,
10194  distance, Rx, Ry, LL,
10195  Aellipsis1, Bellipsis1,fi1,
10196  fmin, fmax, offset, step,
10197  SkewInclWithRespectToS, zpos, zpos1, zpos2,
10198  Tiltdirection1[2],
10199  zl[200],zu[200],
10200  POINTS1[6];
10201 
10202  char nome[300], nome2[300];
10203 
10204 
10205 
10206 
10207 
10208 
10209 
10210 //---------- parallel straws Macro now con anche le tracce MC
10211 
10212  sprintf(nome,"MacroSttwithRfromMCParallelHitswithMCEvent%d", IVOLTE);
10213  sprintf(nome2,"%s.C",nome);
10214  FILE * MACRO = fopen(nome2,"w");
10215 // MACRO = fopen(nome2,"w");
10216  fprintf(MACRO,"void %s()\n{\n",nome);
10217  xmin=1.e20;
10218  xmax=-1.e20;
10219  ymin=1.e20;
10220  ymax=-1.e20;
10221  for( i=0; i< Nhits; i++) {
10222  if( info[i][5] == 1 ) { // parallel straws
10223  if (info[i][0]-info[i][3] < xmin) xmin = info[i][0]-info[i][3];
10224  if (info[i][0]+info[i][3] > xmax) xmax = info[i][0]+info[i][3];
10225  if (info[i][1]-info[i][3] < ymin) ymin = info[i][1]-info[i][3];
10226  if (info[i][1]+info[i][3] > ymax) ymax = info[i][1]+info[i][3];
10227  }
10228  }
10229 
10230  if( xmin > 0. ) xmin = 0.;
10231  if( xmax < 0.) xmax = 0.;
10232  if( ymin > 0. ) ymin = 0.;
10233  if( ymax < 0.) ymax = 0.;
10234 
10235  deltax = xmax-xmin;
10236  deltay = ymax - ymin;
10237 
10238  if( deltax > deltay) {
10239  ymin -= 0.5*(deltax-deltay);
10240  ymax = ymin+ deltax;
10241  delta = deltax;
10242  } else {
10243  xmin -= 0.5*(deltay-deltax);
10244  xmax = xmin+ deltay;
10245  delta= deltay;
10246  }
10247 
10248  xmax = xmax + delta*0.15;
10249  xmin = xmin - delta*0.15;
10250 
10251  ymax = ymax + delta*0.15;
10252  ymin = ymin - delta*0.15;
10253 
10254 
10255  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",xmin,ymin,xmax,ymax);
10256 
10257 
10258  disegnaAssiXY(MACRO,xmin,xmax,ymin,ymax);
10259 
10260 
10261  for( i=0; i< Nhits; i++) {
10262  if( info[i][5] == 1 ) { // parallel straws
10263  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nE%d->SetFillStyle(0);\nE%d->Draw();\n",
10264  i,info[i][0],info[i][1],info[i][3],info[i][3],i,i);
10265  }
10266  }
10267 
10268 
10269 
10270  for( i=0; i< nMCTracks ; i++) {
10271  Int_t icode;
10272  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica, KAPPA, FI0mc ;
10273  PndMCTrack* pMC;
10274  pMC = (PndMCTrack*) fMCTrackArray->At(i);
10275  if ( ! pMC ) continue ;
10276  icode = pMC->GetPdgCode() ; // PDG code of track
10277  Oxx = pMC->GetStartVertex().X(); // X of starting point track
10278  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
10279  Px = pMC->GetMomentum().X();
10280  Py = pMC->GetMomentum().Y();
10281  aaa = sqrt( Px*Px + Py*Py);
10282  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
10283  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
10284  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
10285  if (icode>1000000000) carica = 1.;
10286  else carica = fParticle->Charge()/3. ; // charge of track
10287  if( fabs(carica)<0.1) continue;
10288  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
10289  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
10290  if( fabs( pMC->GetMomentum().Z() )< 1.e-20) KAPPA = 99999999.;
10291  else KAPPA = -carica*0.001*BFIELD*CVEL/pMC->GetMomentum().Z();
10292  FI0mc = fmod(Fifi+ PI, 2.*PI);
10293 
10294 
10295 
10296  fprintf(MACRO,"TEllipse* MC%d = new TEllipse(%f,%f,%f,%f,0.,360.);\nMC%d->SetFillStyle(0);\nMC%d->SetLineColor(3);\nMC%d->Draw();\n",
10297  i,Cx,Cy,Rr,Rr,i,i,i);
10298  }
10299 
10300 
10301 //------------------------------- plotting all the tracks found, with R from corresponding MC track
10302 
10303  for(i=0; i<nTracksFoundSoFar; i++){
10304 
10305  if( daTrackFoundaTrackMC[i] == -1 ) continue;
10306 
10307 
10308 
10309  Int_t icode;
10310  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica, KAPPA, FI0mc ;
10311  PndMCTrack* pMC;
10312  pMC = (PndMCTrack*) fMCTrackArray->At(daTrackFoundaTrackMC[i]);
10313  if ( ! pMC ) continue ;
10314  icode = pMC->GetPdgCode() ; // PDG code of track
10315  Oxx = pMC->GetStartVertex().X(); // X of starting point track
10316  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
10317  Px = pMC->GetMomentum().X();
10318  Py = pMC->GetMomentum().Y();
10319  aaa = sqrt( Px*Px + Py*Py);
10320  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
10321  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
10322  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
10323  if (icode>1000000000) carica = 1.;
10324  else carica = fParticle->Charge()/3. ; // charge of track
10325  if( fabs(carica)<0.1) continue;
10326  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
10327  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
10328  if( fabs( pMC->GetMomentum().Z() )< 1.e-20) KAPPA = 99999999.;
10329  else KAPPA = -carica*0.001*BFIELD*CVEL/pMC->GetMomentum().Z();
10330  FI0mc = fmod(Fifi+ PI, 2.*PI);
10331 
10332 
10333  rrr = Rr;
10334  double angolo = atan2(Oy[i],Ox[i]);
10335  aaa = rrr*cos(angolo);
10336  bbb = rrr*sin(angolo);
10337  fprintf(MACRO,"TEllipse* ris%d=new TEllipse(%f,%f,%f,%f,0.,360.);\nris%d->SetFillStyle(0);\nris%d->SetLineColor(2);\nris%d->Draw();\n",
10338  i,aaa,bbb,rrr,rrr,i,i,i);
10339 
10340 
10341  }
10342 
10343 // -----------
10344 
10345  fprintf(MACRO,"}\n");
10346  fclose(MACRO);
10347 
10348 //------------------------------------------------------------------------------------------------------------
10349 
10350 
10351 
10352 
10353 
10354 
10355  return ;
10356 
10357 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t xmax
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
TVector3 offset(2, 0, 0)
void disegnaAssiXY(FILE *MACRO, double xmin, double xmax, double ymin, double ymax)
Int_t * fParticle
Definition: run_full.C:24
Double_t
const Double_t zpos
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
static const Double_t PI
static const Double_t CVEL
Double_t xmin
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
void PndSttTrackFinderReal::WriteMacroSkewAssociatedHits ( bool  goodskewfit,
Double_t  KAPPA,
Double_t  FI0,
Double_t  D,
Double_t  Fi,
Double_t  R,
Double_t  info[][7],
Int_t  Nincl,
Int_t  Minclinations[],
Double_t  inclination[][3],
Int_t  imaxima,
Int_t  sequentialNTrack,
Short_t  nSttSkewhitinTrack,
Short_t  ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
Short_t  nscitilhits,
Double_t ESSE,
Double_t ZETA 
)
private

Definition at line 4896 of file PndSttTrackFinderReal.cxx.

References angle, atan2(), calculateintersections(), ccc, cos(), disegnaSciTilHit(), Double_t, dx, dy, fabs(), i, infoskew, IVOLTE, offset(), PI, R, sin(), sqrt(), xmax, xmin, and zpos.

Referenced by DoFind().

4917  {
4918 
4919 
4920  Int_t i, j, i1, ii, iii, index, Kincl, nlow, nup, STATUS, imc, Nmin, Nmax;
4921 
4922  Double_t xmin , xmax, ymin, ymax, Ox, Oy,
4923  dx, dy, diff, d1, d2,
4924  delta, deltax, deltay, deltaz, deltaS,
4925  factor,
4926  zmin, zmax, Smin, Smax, S1, S2,
4927  z1, z2, y1, y2,
4928  vx1, vy1, vz1, C0x1, C0y1, C0z1,
4929  aaa, bbb, ccc, angle, minor, major,
4930  distance, Rx, Ry, LL,
4931  Aellipsis1, Bellipsis1,fi1,
4932  fmin, fmax, offset, step,
4933  SkewInclWithRespectToS, zpos, zpos1, zpos2,
4934  Tiltdirection1[2],
4935  zl[200],zu[200],
4936  POINTS1[6];
4937 
4938 
4939 
4940 
4941 
4942 //------------------- skew straws hits Macro now
4943 
4944  char nome2[300],nome[300];
4945  FILE *MACRO;
4946  sprintf(nome,"MacroSttSkewEvent%dT%d",IVOLTE,sequentialNTrack);
4947  sprintf(nome2, "%s.C",nome);
4948  MACRO = fopen(nome2,"w");
4949  fprintf(MACRO,"void %s()\n{\n",nome);
4950 
4951 //KAPPA = 1./166.67 ; FI0 = 1.5*PI;
4952 
4953  Smin=zmin = 1.e10;
4954  Smax=zmax = -zmin;
4955  index=0;
4956 
4957  // prima lo hits SciTil
4958  for(i=0;i<nscitilhits;i++){
4959  if( ESSE[i]>Smax ) Smax=ESSE[i];
4960  if( ESSE[i]<Smin ) Smin=ESSE[i];
4961  if( ZETA[i]>zmax ) zmax=ZETA[i];
4962  if( ZETA[i]<zmin ) zmin=ZETA[i];
4963 
4964 
4965 
4966  }
4967 //-------------------------
4968 
4969 
4970  for( iii=0; iii< nSttSkewhitinTrack; iii++) {
4971  i = infoskew[ ListSkewHitsinTrack[imaxima][iii] ];
4972 
4973  Kincl = (int) info[i][5] - 1;
4974 
4975 
4976  aaa = sqrt(inclination[Kincl][0]*inclination[Kincl][0]+inclination[Kincl][1]*inclination[Kincl][1]+
4977  inclination[Kincl][2]*inclination[Kincl][2]);
4978  vx1 = inclination[Kincl][0]/aaa;
4979  vy1 = inclination[Kincl][1]/aaa;
4980  vz1 = inclination[Kincl][2]/aaa;
4981  C0x1 = info[i][0];
4982  C0y1 = info[i][1];
4983  C0z1 = info[i][2];
4984  Ox = (R+D)*cos(Fi);
4985  Oy = (R+D)*sin(Fi);
4986 
4987  calculateintersections(Ox,Oy,R,C0x1,C0y1,C0z1,info[i][3],
4988  vx1,vy1,vz1,
4989  &STATUS,POINTS1);
4990 
4991  if(STATUS < 0 ) continue ;
4992 
4993 
4994 
4995  for( ii=0; ii<2; ii++){
4996  j=3*ii;
4997  distance = sqrt(
4998  (POINTS1[j]-C0x1)*(POINTS1[j]-C0x1) +
4999  (POINTS1[1+j]-C0y1)*(POINTS1[1+j]-C0y1) +
5000  (POINTS1[2+j]-C0z1)*(POINTS1[2+j]-C0z1)
5001  );
5002 
5003 
5004  Rx = POINTS1[j]-Ox ; // x component Radial vector of cylinder of trajectory
5005  Ry = POINTS1[1+j]-Oy ; // y direction Radial vector of cylinder of trajectory
5006 
5007  aaa = sqrt(Rx*Rx+Ry*Ry);
5008  SkewInclWithRespectToS = (-Ry*vx1 + Rx*vy1)/aaa ;
5009  SkewInclWithRespectToS /= R;
5010  bbb = sqrt( SkewInclWithRespectToS*SkewInclWithRespectToS + vz1*vz1);
5011  // the tilt direction of this ellipse is (1,0) when major axis along Z direction
5012  if( bbb > 1.e-10){
5013  Tiltdirection1[0] = vz1/bbb;
5014  Tiltdirection1[1] = SkewInclWithRespectToS/bbb;
5015  } else {
5016  Tiltdirection1[0] = 1.;
5017  Tiltdirection1[1] = 0.;
5018  }
5019 
5020  LL = fabs(vx1*Rx + vy1*Ry);
5021  if( LL < 1.e-10) continue;
5022  Aellipsis1 = info[i][3]*aaa/LL;
5023 
5024  Bellipsis1 = info[i][3]/R;
5025 
5026  if( distance >= info[i][4] + Aellipsis1) continue;
5027 
5028 
5029 // checks that the projected ellipsis doesn't go out the boundaries of both the skew straw and the trajectory cylinder
5030 
5031 //--------------------------
5032 
5033 
5034  fi1 = atan2(POINTS1[j+1]-Oy, POINTS1[j]-Ox) ; // atan2 returns radians in (-pi and +pi]
5035  if( fi1 < 0.) fi1 += 2.*PI;
5036 
5037  if( zmin > POINTS1[j+2] - Aellipsis1 ) zmin = POINTS1[j+2] - Aellipsis1;
5038  if( zmax < POINTS1[j+2] + Aellipsis1 ) zmax = POINTS1[j+2] + Aellipsis1;
5039 
5040  if( Smin > fi1 - Bellipsis1 ) Smin = fi1 - Bellipsis1;
5041  if( Smax < fi1 + Bellipsis1 ) Smax = fi1 + Bellipsis1;
5042 
5043 
5044  Double_t rotation1 = 180.*atan2(Tiltdirection1[1],Tiltdirection1[0])/PI;
5045 fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.,%f);\nE%d->SetFillStyle(0);\n",
5046  index,POINTS1[j+2],fi1,Aellipsis1,Bellipsis1,rotation1,index);
5047 
5048 
5049 
5050 
5051 
5052 // ------ se lo hit e' spurio marcalo in rosso
5053 
5054 
5055 
5056 
5057  index++;
5058 
5059  } // end of for( ii=0; ii<2; ii++)
5060 
5061  } // end of for( i=1; i< Nhits; i++)
5062 
5063 
5064  if(!(index+nscitilhits==0 || zmax < zmin || Smax < Smin )) {
5065  aaa = Smax-Smin;
5066  Smin -= aaa*1.;
5067  Smax += aaa*1.;
5068 
5069  aaa = zmax-zmin;
5070  zmin -= aaa*0.05;
5071  zmax += aaa*0.05;
5072 
5073  if(Smax > 2.*PI) Smax = 2.*PI;
5074  if( Smin < 0.) Smin = 0.;
5075 
5076 // Smin=0.;
5077 // Smax=2.*PI;
5078 
5079 
5080  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",zmin,Smin,zmax,Smax);
5081  for( ii=0; ii< index; ii++) {
5082  fprintf(MACRO,"E%d->Draw();\n",ii);
5083  }
5084 
5085  deltaz = zmax-zmin;
5086  deltaS = Smax-Smin;
5087  fprintf(MACRO,"TGaxis *Assex = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",
5088  zmin+0.05*deltaz,Smin+0.05*deltaS,zmax-0.05*deltaz,Smin+0.05*deltaS,zmin+0.05*deltaz,zmax-0.05*deltaz);
5089  fprintf(MACRO,"Assex->Draw();\n");
5090  fprintf(MACRO,"TGaxis *Assey = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",
5091  zmin+0.05*deltaz,Smin+0.05*deltaS,zmin+0.05*deltaz,Smax-0.05*deltaS,Smin+0.05*deltaS,Smax-0.05*deltaS);
5092  fprintf(MACRO,"Assey->Draw();\n");
5093 
5094 //------------
5095 // plot di eventuali hits SciTil;
5096  for(i=0;i<nscitilhits;i++){
5097 // fprintf(MACRO,"SciT%d->Draw();\n",i);
5098 
5100  MACRO,
5101  i,
5102  ZETA[i],
5103  ESSE[i],
5104  1
5105  );
5106 
5107  }
5108 //------------
5109 
5110 // --------------------------------
5111 
5112 // plot della traccia trovata dal finder
5113  if(goodskewfit) {
5114 
5115 
5116 // if ( fabs(KAPPA) > 1.e-10 && fabs(KAPPA) < 1.e10 ) {
5117 
5118  if ( fabs(KAPPA) <= 1.e-10 || fabs(KAPPA) >= 1.e10 ) {
5119  cout<<"PndSttTrackFinderReal::WriteMacroSkewAssociatedHits,"
5120  <<" this track found by PR not plotted"
5121  <<"\n\t because KAPPA = "<<KAPPA<<endl;
5122  } else {
5123 
5124  fmin = KAPPA*zmin + FI0;
5125  fmax = KAPPA*zmax + FI0;
5126 
5127 
5128  if ( KAPPA >= 0.) {
5129  fmin = KAPPA*zmin + FI0;
5130  fmax = KAPPA*zmax + FI0;
5131  } else {
5132  fmax = KAPPA*zmin + FI0;
5133  fmin = KAPPA*zmax + FI0;
5134  }
5135 
5136  if( fmax>=0.) {
5137  Nmax = (int) (0.5*fmax/ PI);
5138  } else {
5139  Nmax = ( (int) (0.5*fmax/ PI) ) -1;
5140  }
5141  if( fmin>=0.) {
5142  Nmin = (int) (0.5*fmin/ PI);
5143  } else {
5144  Nmin = ((int) (0.5*fmin/ PI) )-1;
5145  }
5146  for(i=Nmin; i<= Nmax;i++){
5147  offset = 2.*PI*i;
5148  z1 = (i*2.*PI-FI0)/KAPPA;
5149  z2 = ((i+1)*2.*PI-FI0)/KAPPA;
5150 fprintf(MACRO,"TLine* FOUND%d = new TLine(%f,%f,%f,%f);\nFOUND%d->SetLineColor(2);\nFOUND%d->Draw();\n",
5151  i-Nmin,z1,0.,z2, 2.*PI,i-Nmin,i-Nmin);
5152 
5153  } // end of for(i=Nmin; i<= Nmax;++)
5154 
5155  } // end of if ( fabs(KAPPA) <= 1.e-10 || fabs(KAPPA) >= 1.e10 )
5156  } // end of if(goodskewfit)
5157  } // end of if(!(index+nscitilhits==0||zmax < zmin||Smax < Smin))
5158 
5159  fprintf(MACRO,"}\n");
5160  fclose(MACRO);
5161 
5162 
5163 
5164 }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t xmax
TVector3 offset(2, 0, 0)
void calculateintersections(Double_t Ox, Double_t Oy, Double_t R, 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)
Double_t
const Double_t zpos
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
static const Double_t PI
void disegnaSciTilHit(FILE *MACRO, int ScitilHit, double posx, double posy, int tipo)
Double_t xmin
Double_t angle
Double_t R
Definition: checkhelixhit.C:61
void PndSttTrackFinderReal::WriteMacroSkewAssociatedHitswithMC ( bool  goodskewfit,
Double_t  KAPPA,
Double_t  FI0,
Double_t  D,
Double_t  Fi,
Double_t  R,
Double_t  info[][7],
Int_t  Nincl,
Int_t  Minclinations[],
Double_t  inclination[][3],
Int_t  imaxima,
Int_t  sequentialNTrack,
Short_t  nSttSkewhitinTrack,
Short_t  ListSkewHitsinTrack[MAXTRACKSPEREVENT][nmaxHitsInTrack],
Short_t  nSkewCommon,
Short_t  SkewCommonList[MAXTRACKSPEREVENT][nmaxHits],
Short_t  daTrackFoundaTrackMC,
Short_t  nMCSkewAlone[MAXTRACKSPEREVENT],
Short_t  MCSkewAloneList[MAXTRACKSPEREVENT][nmaxHits],
Short_t  nscitilhits,
Double_t ESSE,
Double_t ZETA 
)
private

Definition at line 5187 of file PndSttTrackFinderReal.cxx.

References angle, atan2(), BFIELD, calculateintersections(), ccc, cos(), CVEL, disegnaSciTilHit(), Double_t, dx, dy, fabs(), fMCTrackArray, fParticle, PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), PndMCTrack::GetStartVertex(), i, infoskew, IVOLTE, nmaxHits, offset(), PI, R, sin(), sqrt(), xmax, xmin, and zpos.

Referenced by DoFind().

5211  {
5212 
5213 
5214  bool flaggo;
5215  Int_t i, j, i1, ii, iii, index, Kincl, nlow, nup, STATUS, imc, Nmin, Nmax;
5216 
5217  Short_t Lista[nmaxHits];
5218 
5219  Double_t xmin , xmax, ymin, ymax, Ox, Oy,
5220  dx, dy, diff, d1, d2,
5221  delta, deltax, deltay, deltaz, deltaS,
5222  factor,
5223  zmin, zmax, Smin, Smax, S1, S2,
5224  z1, z2, y1, y2,
5225  vx1, vy1, vz1, C0x1, C0y1, C0z1,
5226  aaa, bbb, ccc, angle, minor, major,
5227  distance, Rx, Ry, LL,
5228  Aellipsis1, Bellipsis1,fi1,
5229  fmin, fmax, offset, step,
5230  SkewInclWithRespectToS, zpos, zpos1, zpos2,
5231  Tiltdirection1[2],
5232  zl[200],zu[200],
5233  POINTS1[6];
5234 
5235 
5236  TDatabasePDG *fdbPDG;
5237  TParticlePDG *fParticle;
5238 
5239 
5240 
5241 //------------------- skew straws hits Macro now
5242 
5243  char nome2[300],nome[300];
5244  FILE *MACRO;
5245  sprintf(nome, "MacroSttSkewwithMCEvent%dT%d", IVOLTE,sequentialNTrack);
5246  sprintf(nome2, "%s.C",nome);
5247  MACRO = fopen(nome2,"w");
5248  fprintf(MACRO,"void %s()\n{\n",nome);
5249 
5250 //KAPPA = 1./166.67 ; FI0 = 1.5*PI;
5251 
5252  Smin=zmin = 1.e10;
5253  Smax=zmax = -zmin;
5254  index=0;
5255 
5256 // prima lo (gli) hits SciTil
5257  for(i=0;i<nscitilhits;i++){
5258  if( ESSE[i]>Smax ) Smax=ESSE[i];
5259  if( ESSE[i]<Smin ) Smin=ESSE[i];
5260  if( ZETA[i]>zmax ) zmax=ZETA[i];
5261  if( ZETA[i]<zmin ) zmin=ZETA[i];
5262 
5263  }
5264 //----------------------------
5265  for( iii=0; iii< nSttSkewhitinTrack; iii++) {
5266  i = infoskew[ ListSkewHitsinTrack[imaxima][iii] ];
5267 
5268  Kincl = (int) info[i][5] - 1;
5269 
5270 
5271  aaa = sqrt(inclination[Kincl][0]*inclination[Kincl][0]+
5272  inclination[Kincl][1]*inclination[Kincl][1]+
5273  inclination[Kincl][2]*inclination[Kincl][2]);
5274  vx1 = inclination[Kincl][0]/aaa;
5275  vy1 = inclination[Kincl][1]/aaa;
5276  vz1 = inclination[Kincl][2]/aaa;
5277  C0x1 = info[i][0];
5278  C0y1 = info[i][1];
5279  C0z1 = info[i][2];
5280  Ox = (R+D)*cos(Fi);
5281  Oy = (R+D)*sin(Fi);
5282 
5283  calculateintersections(Ox,Oy,R,C0x1,C0y1,C0z1,info[i][3],
5284  vx1,vy1,vz1,
5285  &STATUS,POINTS1);
5286 
5287  if(STATUS < 0 ) continue ;
5288 
5289 
5290 
5291  for( ii=0; ii<2; ii++){
5292  j=3*ii;
5293  distance = sqrt(
5294  (POINTS1[j]-C0x1)*(POINTS1[j]-C0x1) +
5295  (POINTS1[1+j]-C0y1)*(POINTS1[1+j]-C0y1) +
5296  (POINTS1[2+j]-C0z1)*(POINTS1[2+j]-C0z1)
5297  );
5298 
5299 
5300  Rx = POINTS1[j]-Ox ; // x component Radial vector of cylinder of trajectory
5301  Ry = POINTS1[1+j]-Oy ; // y direction Radial vector of cylinder of trajectory
5302 
5303  aaa = sqrt(Rx*Rx+Ry*Ry);
5304  SkewInclWithRespectToS = (-Ry*vx1 + Rx*vy1)/aaa ;
5305  SkewInclWithRespectToS /= R;
5306  bbb = sqrt( SkewInclWithRespectToS*SkewInclWithRespectToS + vz1*vz1);
5307  // the tilt direction of this ellipse is (1,0) when major axis along Z direction
5308  if( bbb > 1.e-10){
5309  Tiltdirection1[0] = vz1/bbb;
5310  Tiltdirection1[1] = SkewInclWithRespectToS/bbb;
5311  } else {
5312  Tiltdirection1[0] = 1.;
5313  Tiltdirection1[1] = 0.;
5314  }
5315 
5316  LL = fabs(vx1*Rx + vy1*Ry);
5317  if( LL < 1.e-10) continue;
5318  Aellipsis1 = info[i][3]*aaa/LL;
5319 
5320  Bellipsis1 = info[i][3]/R;
5321 
5322  if( distance >= info[i][4] + Aellipsis1) continue;
5323 
5324 
5325 // checks that the projected ellipsis doesn't go out the boundaries of both the skew straw and the trajectory cylinder
5326 
5327 //--------------------------
5328 
5329 
5330  fi1 = atan2(POINTS1[j+1]-Oy, POINTS1[j]-Ox) ; // atan2 returns radians in (-pi and +pi]
5331  if( fi1 < 0.) fi1 += 2.*PI;
5332 
5333  if( zmin > POINTS1[j+2] - Aellipsis1 ) zmin = POINTS1[j+2] - Aellipsis1;
5334  if( zmax < POINTS1[j+2] + Aellipsis1 ) zmax = POINTS1[j+2] + Aellipsis1;
5335 
5336  if( Smin > fi1 - Bellipsis1 ) Smin = fi1 - Bellipsis1;
5337  if( Smax < fi1 + Bellipsis1 ) Smax = fi1 + Bellipsis1;
5338 
5339 
5340  Lista[index] = i+ii*10000; // do la possibilita' di plottare 2 hits skew che vengono dalla
5341  // stessa skew straw.
5342 
5343  Double_t rotation1 = 180.*atan2(Tiltdirection1[1],Tiltdirection1[0])/PI;
5344  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.,%f);\nE%d->SetFillStyle(0);\n",
5345  i+ii*10000,POINTS1[j+2],fi1,Aellipsis1,Bellipsis1,rotation1,i+ii*10000);
5346 // index,POINTS1[j+2],fi1,Aellipsis1,Bellipsis1,rotation1,index);
5347 
5348 // ------ se lo hit e' spurio marcalo in rosso
5349  flaggo=true;
5350  for( i1=0; i1<nSkewCommon; i1++){
5351  if ( SkewCommonList[ imaxima ][i1] == i ){
5352  flaggo=false;
5353  break;
5354  }
5355 
5356  }
5357  if(flaggo) fprintf(MACRO,"E%d->SetLineColor(2);\n",i+ii*10000);
5358 
5359  index++;
5360 
5361  } // end of for( ii=0; ii<2; ii++)
5362 
5363  } // end of for( iii=0; iii< nSttSkewhitinTrack; iii++)
5364 
5365 //-------------------------------
5366 
5367 
5368 
5369 //------ aggiungo in blu eventuali punti della traccia MC che sono non mecciati
5370 
5371  for( iii=0; iii< nMCSkewAlone[imaxima]; iii++) {
5372  i = MCSkewAloneList[imaxima][iii];
5373 
5374  Kincl = (int) info[i][5] - 1;
5375 
5376 
5377  aaa = sqrt(inclination[Kincl][0]*inclination[Kincl][0]+inclination[Kincl][1]*inclination[Kincl][1]+
5378  inclination[Kincl][2]*inclination[Kincl][2]);
5379  vx1 = inclination[Kincl][0]/aaa;
5380  vy1 = inclination[Kincl][1]/aaa;
5381  vz1 = inclination[Kincl][2]/aaa;
5382  C0x1 = info[i][0];
5383  C0y1 = info[i][1];
5384  C0z1 = info[i][2];
5385  Ox = (R+D)*cos(Fi);
5386  Oy = (R+D)*sin(Fi);
5387 
5388  calculateintersections(Ox,Oy,R,C0x1,C0y1,C0z1,info[i][3],
5389  vx1,vy1,vz1,
5390  &STATUS,POINTS1);
5391 
5392  if(STATUS < 0 ) continue ;
5393 
5394 
5395  for( ii=0; ii<2; ii++){
5396  j=3*ii;
5397  distance = sqrt(
5398  (POINTS1[j]-C0x1)*(POINTS1[j]-C0x1) +
5399  (POINTS1[1+j]-C0y1)*(POINTS1[1+j]-C0y1) +
5400  (POINTS1[2+j]-C0z1)*(POINTS1[2+j]-C0z1)
5401  );
5402 
5403 
5404  Rx = POINTS1[j]-Ox ; // x component Radial vector of cylinder of trajectory
5405  Ry = POINTS1[1+j]-Oy ; // y direction Radial vector of cylinder of trajectory
5406 
5407  aaa = sqrt(Rx*Rx+Ry*Ry);
5408  SkewInclWithRespectToS = (-Ry*vx1 + Rx*vy1)/aaa ;
5409  SkewInclWithRespectToS /= R;
5410  bbb = sqrt( SkewInclWithRespectToS*SkewInclWithRespectToS + vz1*vz1);
5411  // the tilt direction of this ellipse is (1,0) when major axis along Z direction
5412  if( bbb > 1.e-10){
5413  Tiltdirection1[0] = vz1/bbb;
5414  Tiltdirection1[1] = SkewInclWithRespectToS/bbb;
5415  } else {
5416  Tiltdirection1[0] = 1.;
5417  Tiltdirection1[1] = 0.;
5418  }
5419 
5420  LL = fabs(vx1*Rx + vy1*Ry);
5421  if( LL < 1.e-10) continue;
5422  Aellipsis1 = info[i][3]*aaa/LL;
5423 
5424  Bellipsis1 = info[i][3]/R;
5425 
5426  if( distance >= info[i][4] + Aellipsis1) continue;
5427 
5428 
5429 //--------------------------
5430 
5431 
5432  fi1 = atan2(POINTS1[j+1]-Oy, POINTS1[j]-Ox) ; // atan2 returns radians in (-pi and +pi]
5433  if( fi1 < 0.) fi1 += 2.*PI;
5434 
5435  if( zmin > POINTS1[j+2] - Aellipsis1 ) zmin = POINTS1[j+2] - Aellipsis1;
5436  if( zmax < POINTS1[j+2] + Aellipsis1 ) zmax = POINTS1[j+2] + Aellipsis1;
5437 
5438  if( Smin > fi1 - Bellipsis1 ) Smin = fi1 - Bellipsis1;
5439  if( Smax < fi1 + Bellipsis1 ) Smax = fi1 + Bellipsis1;
5440 
5441 
5442  Double_t rotation1 = 180.*atan2(Tiltdirection1[1],Tiltdirection1[0])/PI;
5443  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.,%f);\nE%d->SetFillStyle(0);\n",
5444  i+ii*10000,POINTS1[j+2],fi1,Aellipsis1,Bellipsis1,rotation1,i+ii*10000);
5445 
5446 // ------ marca lo hit in blu
5447  fprintf(MACRO,"E%d->SetLineColor(4);\n",i+ii*10000);
5448  Lista[index] = i+ii*10000; // do la possibilita' di plottare 2 hits skew che vengono dalla
5449  // stessa skew straw.
5450  index++;
5451 
5452  } // end of for( ii=0; ii<2; ii++)
5453 
5454  } // end of for( iii=0; iii< nMCSkewAlone[imaxima]; iii++)
5455 
5456 //-------------------------------
5457 //------ fine aggiunta in blu eventuali punti della traccia MC che sono non mecciati
5458 
5459  if( !(index+nscitilhits==0|| zmax < zmin || Smax < Smin ) ){
5460  aaa = Smax-Smin;
5461  Smin -= aaa*1.;
5462  Smax += aaa*1.;
5463 
5464  aaa = zmax-zmin;
5465  zmin -= aaa*0.05;
5466  zmax += aaa*0.05;
5467 
5468  if(Smax > 2.*PI) Smax = 2.*PI;
5469  if( Smin < 0.) Smin = 0.;
5470 
5471 // Smin=0.;
5472 // Smax=2.*PI;
5473 
5474 
5475  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",zmin,Smin,zmax,Smax);
5476  for( ii=0; ii< index; ii++) {
5477 // fprintf(MACRO,"E%d->Draw();\n",ii);
5478  fprintf(MACRO,"E%d->Draw();\n",Lista[ii]);
5479  }
5480 
5481  deltaz = zmax-zmin;
5482  deltaS = Smax-Smin;
5483  fprintf(MACRO,"TGaxis *Assex = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",
5484  zmin+0.05*deltaz,Smin+0.05*deltaS,zmax-0.05*deltaz,Smin+0.05*deltaS,zmin+0.05*deltaz,zmax-0.05*deltaz);
5485  fprintf(MACRO,"Assex->Draw();\n");
5486  fprintf(MACRO,"TGaxis *Assey = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",
5487  zmin+0.05*deltaz,Smin+0.05*deltaS,zmin+0.05*deltaz,Smax-0.05*deltaS,Smin+0.05*deltaS,Smax-0.05*deltaS);
5488  fprintf(MACRO,"Assey->Draw();\n");
5489 
5490 
5491 
5492 //------------
5493 // plot di eventuali hits SciTil;
5494  for(i=0;i<nscitilhits;i++){
5495 // fprintf(MACRO,"SciT%d->Draw();\n",i);
5496 
5498  MACRO,
5499  i,
5500  ZETA[i],
5501  ESSE[i],
5502  1
5503  );
5504 
5505  }
5506 //------------
5507 
5508 // --------------------------------
5509 
5510 // plot della traccia trovata dal finder
5511 
5512  if(goodskewfit) {
5513  if ( fabs(KAPPA) > 1.e-10 && fabs(KAPPA) < 1.e10) {
5514  fmin = KAPPA*zmin + FI0;
5515  fmax = KAPPA*zmax + FI0;
5516 
5517  if ( KAPPA >= 0.) {
5518  fmin = KAPPA*zmin + FI0;
5519  fmax = KAPPA*zmax + FI0;
5520  } else {
5521  fmax = KAPPA*zmin + FI0;
5522  fmin = KAPPA*zmax + FI0;
5523  }
5524 
5525 
5526  if( fmax>=0.) {
5527  Nmax = (int) (0.5*fmax/ PI);
5528  } else {
5529  Nmax = ( (int) (0.5*fmax/ PI) ) -1;
5530  }
5531  if( fmin>=0.) {
5532  Nmin = (int) (0.5*fmin/ PI);
5533  } else {
5534  Nmin = ((int) (0.5*fmin/ PI) )-1;
5535  }
5536  for(i=Nmin; i<= Nmax;i++){
5537  offset = 2.*PI*i;
5538  z1 = (i*2.*PI-FI0)/KAPPA;
5539  z2 = ((i+1)*2.*PI-FI0)/KAPPA;
5540  fprintf(MACRO,"TLine* FOUND%d = new TLine(%f,%f,%f,%f);\nFOUND%d->SetLineColor(2);\nFOUND%d->Draw();\n",
5541  i-Nmin,z1,0.,z2, 2.*PI,i-Nmin,i-Nmin);
5542 
5543  } // end of for(i=Nmin; i<= Nmax;++)
5544 
5545  }else{// continuation of if ( fabs(KAPPA) > 1.e-10 && fabs(KAPPA) < 1.e10)
5546  cout<<"PndSttTrackFinderReal::WriteMacroSkewAssociatedHitswithMC,"
5547  <<" this track found by PR not plotted"
5548  <<"\n\t because KAPPA = "<<KAPPA<<endl;
5549  }
5550 
5551  } // end of if(goodskewfit)
5552 //--------------------------------------------- qui ci aggiungo le traccie MC
5553 
5554 
5555  imc= daTrackFoundaTrackMC ;
5556 
5557  Int_t icode;
5558  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica ;
5559  PndMCTrack* pMC;
5560  pMC = (PndMCTrack*) fMCTrackArray->At(imc);
5561  if ( pMC ) {
5562  icode = pMC->GetPdgCode() ; // PDG code of track
5563  Oxx = pMC->GetStartVertex().X(); // X of starting point track
5564  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
5565  Px = pMC->GetMomentum().X();
5566  Py = pMC->GetMomentum().Y();
5567  aaa = sqrt( Px*Px + Py*Py);
5568  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
5569  fdbPDG= TDatabasePDG::Instance();
5570  fParticle= fdbPDG->GetParticle(icode);
5571  if (icode>1000000000) carica = 1.;
5572  else carica = fParticle->Charge()/3. ; // charge of track
5573  if( fabs(carica)>=0.1) {
5574 
5575  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
5576  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
5577  Fifi = atan2(Cy, Cx); // MC truth Fifi angle of circle of Helix trajectory
5578  if(Fifi<0.) Fifi += 2.*PI;
5579  if( fabs( pMC->GetMomentum().Z() )< 1.e-20) KAPPA = 99999999.;
5580  else KAPPA = -carica*0.001*BFIELD*CVEL/pMC->GetMomentum().Z();
5581 
5582  FI0 = fmod(Fifi+ PI, 2.*PI);
5583 
5584 
5585 
5586  if ( fabs(KAPPA) > 1.e-10 && fabs(KAPPA) < 1.e10) {
5587  fmin = KAPPA*zmin + FI0;
5588  fmax = KAPPA*zmax + FI0;
5589  if( fmax>=0.) {
5590  Nmax = (int) (0.5*fmax/ PI);
5591  } else {
5592  Nmax = ( (int) (0.5*fmax/ PI) ) -1;
5593  }
5594  if( fmin>=0.) {
5595  Nmin = (int) (0.5*fmin/ PI);
5596  } else {
5597  Nmin = ((int) (0.5*fmin/ PI) )-1;
5598  }
5599 
5600  for(i=Nmin; i<= Nmax;i++){
5601  offset = 2.*PI*i;
5602  z1 = (i*2.*PI-FI0)/KAPPA;
5603  z2 = ((i+1)*2.*PI-FI0)/KAPPA;
5604  fprintf(MACRO,"TLine* MC%d_%d = new TLine(%f,%f,%f,%f);\nMC%d_%d->SetLineColor(3);\nMC%d_%d->Draw();\n",
5605  imc,i-Nmin,z1,0.,z2, 2.*PI,imc,i-Nmin,imc,i-Nmin);
5606 
5607  } // end of for(i=Nmin; i<= Nmax;++)
5608 
5609 
5610 
5611 
5612 
5613 
5614  } else { // end of if ( fabs(KAPPA) > 1.e-10 && fabs(KAPPA) < 1.e10)
5615 cout<<"PndSttTrackFinderReal::WriteMacroSkewAssociatedHits, this track found by PR not plotted"
5616  <<"\n\t because KAPPA = "<<KAPPA<<endl;
5617  }
5618 
5619 
5620 
5621  } // end of if( fabs(carica)>=0.1)
5622  } // end of if ( pMC )
5623 
5624  } // end of if( !(index+nscitilhits==0|| zmax < zmin || Smax < Smin ) )
5625 
5626 
5627 
5628  fprintf(MACRO,"}\n");
5629  fclose(MACRO);
5630 
5631 
5632 
5633 
5634 
5635  }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t xmax
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
TVector3 offset(2, 0, 0)
void calculateintersections(Double_t Ox, Double_t Oy, Double_t R, 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)
Int_t * fParticle
Definition: run_full.C:24
Double_t
const Double_t zpos
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
static const Short_t nmaxHits
double dx
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
static const Double_t PI
void disegnaSciTilHit(FILE *MACRO, int ScitilHit, double posx, double posy, int tipo)
static const Double_t CVEL
Double_t xmin
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
Double_t R
Definition: checkhelixhit.C:61
void PndSttTrackFinderReal::WriteMacroSkewAssociatedHitswithRfromMC ( Double_t  KAPPA,
Double_t  FI0,
Double_t  D,
Double_t  Fi,
Double_t  R,
Int_t  Nhits,
Double_t  info[][7],
Int_t  Nincl,
Int_t  Minclinations[],
Double_t  inclination[][3],
Int_t  imaxima,
Int_t  nMaxima 
)
private

Definition at line 10371 of file PndSttTrackFinderReal.cxx.

References angle, atan2(), BFIELD, calculateintersections(), ccc, cos(), CVEL, Double_t, dx, dy, fabs(), fMCTrackArray, fParticle, PndMCTrack::GetMomentum(), PndMCTrack::GetPdgCode(), PndMCTrack::GetStartVertex(), i, IVOLTE, nMCTracks, offset(), PI, R, SEMILENGTH_STRAIGHT, sin(), sqrt(), xmax, xmin, ZCENTER_STRAIGHT, and zpos.

10376  {
10377 
10378 
10379 
10380  Int_t i, j, i1, ii, index, Kincl, nlow, nup, STATUS, imc, Nmin, Nmax;
10381 
10382  Double_t xmin , xmax, ymin, ymax, Ox, Oy,
10383  dx, dy, diff, d1, d2,
10384  delta, deltax, deltay, deltaz, deltaS,
10385  factor,
10386  zmin, zmax, Smin, Smax, S1, S2,
10387  z1, z2, y1, y2,
10388  vx1, vy1, vz1, C0x1, C0y1, C0z1,
10389  aaa, bbb, ccc, angle, minor, major,
10390  distance, Rx, Ry, LL,
10391  Aellipsis1, Bellipsis1,fi1,
10392  fmin, fmax, offset, step,
10393  SkewInclWithRespectToS, zpos, zpos1, zpos2,
10394  Tiltdirection1[2],
10395  zl[200],zu[200],
10396  POINTS1[6];
10397 
10398 
10399 
10400 
10401 //------------------- skew straws hits Macro now
10402 
10403  char nome2[300],nome[300];
10404  FILE *MACRO;
10405  sprintf(nome, "MacroSttParTrack%dSkewTrack%dSkewHitswithRfromMCEvent%d",imaxima,nMaxima, IVOLTE);
10406  sprintf(nome2, "%s.C",nome);
10407  MACRO = fopen(nome2,"w");
10408  fprintf(MACRO,"void %s()\n{\n",nome);
10409 
10410 //KAPPA = 1./166.67 ; FI0 = 1.5*PI;
10411 
10412  Smin=zmin = 1.e10;
10413  Smax=zmax = -zmin;
10414  index=0;
10415 
10416  for( i=0; i< Nhits; i++) {
10417  if( info[i][5] == 1. ) continue; // exclude parallel straws
10418 
10419  Kincl = (int) info[i][5] - 1;
10420 
10421 
10422  aaa = sqrt(inclination[Kincl][0]*inclination[Kincl][0]+inclination[Kincl][1]*inclination[Kincl][1]+
10423  inclination[Kincl][2]*inclination[Kincl][2]);
10424  vx1 = inclination[Kincl][0]/aaa;
10425  vy1 = inclination[Kincl][1]/aaa;
10426  vz1 = inclination[Kincl][2]/aaa;
10427  C0x1 = info[i][0];
10428  C0y1 = info[i][1];
10429  C0z1 = info[i][2];
10430  Ox = (R+D)*cos(Fi);
10431  Oy = (R+D)*sin(Fi);
10432 
10433  calculateintersections(Ox,Oy,R,C0x1,C0y1,C0z1,info[i][3],
10434  vx1,vy1,vz1,
10435  &STATUS,POINTS1);
10436 
10437  if(STATUS < 0 ) continue ;
10438 
10439 
10440 
10441  for( ii=0; ii<2; ii++){
10442  j=3*ii;
10443  distance = sqrt(
10444  (POINTS1[j]-C0x1)*(POINTS1[j]-C0x1) +
10445  (POINTS1[1+j]-C0y1)*(POINTS1[1+j]-C0y1) +
10446  (POINTS1[2+j]-C0z1)*(POINTS1[2+j]-C0z1)
10447  );
10448 
10449 
10450  Rx = POINTS1[j]-Ox ; // x component Radial vector of cylinder of trajectory
10451  Ry = POINTS1[1+j]-Oy ; // y direction Radial vector of cylinder of trajectory
10452 
10453  aaa = sqrt(Rx*Rx+Ry*Ry);
10454  SkewInclWithRespectToS = (-Ry*vx1 + Rx*vy1)/aaa ;
10455  SkewInclWithRespectToS /= R;
10456  bbb = sqrt( SkewInclWithRespectToS*SkewInclWithRespectToS + vz1*vz1);
10457  // the tilt direction of this ellipse is (1,0) when major axis along Z direction
10458  if( bbb > 1.e-10){
10459  Tiltdirection1[0] = vz1/bbb;
10460  Tiltdirection1[1] = SkewInclWithRespectToS/bbb;
10461  } else {
10462  Tiltdirection1[0] = 1.;
10463  Tiltdirection1[1] = 0.;
10464  }
10465 
10466  LL = fabs(vx1*Rx + vy1*Ry);
10467  if( LL < 1.e-10) continue;
10468  Aellipsis1 = info[i][3]*aaa/LL;
10469 
10470  Bellipsis1 = info[i][3]/R;
10471 
10472  if( distance >= info[i][4] + Aellipsis1) continue;
10473 
10474 
10475 // checks that the projected ellipsis doesn't go out the boundaries of both the skew straw and the trajectory cylinder
10476 
10477  if(
10478  fabs(POINTS1[j+2]-ZCENTER_STRAIGHT) > SEMILENGTH_STRAIGHT- Aellipsis1 ||
10479  distance + bbb > info[i][4] // the ellipsis goes out of the boundaries of the skew straw
10480  ) {
10481 cout<<"the ellipsis goes out of the boundaries of the skew straw, hit n. "<<i<<endl
10482  <<"dis. from center "<<distance+bbb<<", length of the straw "<<info[i][4]<<endl;
10483  continue;
10484  }
10485 //--------------------------
10486 
10487 
10488  fi1 = atan2(POINTS1[j+1]-Oy, POINTS1[j]-Ox) ; // atan2 returns radians in (-pi and +pi]
10489  if( fi1 < 0.) fi1 += 2.*PI;
10490 
10491  if( zmin > POINTS1[j+2] - Aellipsis1 ) zmin = POINTS1[j+2] - Aellipsis1;
10492  if( zmax < POINTS1[j+2] + Aellipsis1 ) zmax = POINTS1[j+2] + Aellipsis1;
10493 
10494  if( Smin > fi1 - Bellipsis1 ) Smin = fi1 - Bellipsis1;
10495  if( Smax < fi1 + Bellipsis1 ) Smax = fi1 + Bellipsis1;
10496 
10497 
10498  Double_t rotation1 = 180.*atan2(Tiltdirection1[1],Tiltdirection1[0])/PI;
10499  fprintf(MACRO,"TEllipse* E%d = new TEllipse(%f,%f,%f,%f,0.,360.,%f);\nE%d->SetFillStyle(0);\n",
10500  index,POINTS1[j+2],fi1,Aellipsis1,Bellipsis1,rotation1,index);
10501 
10502  index++;
10503 
10504  } // end of for( ii=0; ii<2; ii++)
10505 
10506  } // end of for( i=1; i< Nhits; i++)
10507 
10508 
10509  if(index!=0 && zmax >= zmin && Smax >= Smin ){
10510  aaa = Smax-Smin;
10511  Smin -= aaa*1.;
10512  Smax += aaa*1.;
10513 
10514  aaa = zmax-zmin;
10515  zmin -= aaa*0.05;
10516  zmax += aaa*0.05;
10517 
10518  if(Smax > 2.*PI) Smax = 2.*PI;
10519  if( Smin < 0.) Smin = 0.;
10520 
10521 // Smin=0.;
10522 // Smax=2.*PI;
10523 
10524 
10525  fprintf(MACRO,"TCanvas* my= new TCanvas();\nmy->Range(%f,%f,%f,%f);\n",zmin,Smin,zmax,Smax);
10526  for( ii=0; ii< index; ii++) {
10527  fprintf(MACRO,"E%d->Draw();\n",ii);
10528  }
10529 
10530  deltaz = zmax-zmin;
10531  deltaS = Smax-Smin;
10532  fprintf(MACRO,"TGaxis *Assex = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",
10533  zmin+0.05*deltaz,Smin+0.05*deltaS,zmax-0.05*deltaz,Smin+0.05*deltaS,zmin+0.05*deltaz,zmax-0.05*deltaz);
10534  fprintf(MACRO,"Assex->Draw();\n");
10535  fprintf(MACRO,"TGaxis *Assey = new TGaxis(%f,%f,%f,%f,%f,%f,510);\n",
10536  zmin+0.05*deltaz,Smin+0.05*deltaS,zmin+0.05*deltaz,Smax-0.05*deltaS,Smin+0.05*deltaS,Smax-0.05*deltaS);
10537  fprintf(MACRO,"Assey->Draw();\n");
10538 
10539 
10540 
10541 
10542 // --------------------------------
10543 
10544 // plot della traccia trovata dal finder
10545 
10546 
10547  if ( KAPPA >= 0.) {
10548  fmin = KAPPA*zmin + FI0;
10549  fmax = KAPPA*zmax + FI0;
10550  } else {
10551  fmax = KAPPA*zmin + FI0;
10552  fmin = KAPPA*zmax + FI0;
10553  }
10554  if( fmax>=0.) {
10555  Nmax = (int) (0.5*fmax/ PI);
10556  } else {
10557  Nmax = ( (int) (0.5*fmax/ PI) ) -1;
10558  }
10559  if( fmin>=0.) {
10560  Nmin = (int) (0.5*fmin/ PI);
10561  } else {
10562  Nmin = ((int) (0.5*fmin/ PI) )-1;
10563  }
10564  for(i=Nmin; i<= Nmax;i++){
10565  offset = 2.*PI*i;
10566  z1 = (i*2.*PI-FI0)/KAPPA;
10567  z2 = ((i+1)*2.*PI-FI0)/KAPPA;
10568  fprintf(MACRO,"TLine* FOUND%d = new TLine(%f,%f,%f,%f);\nFOUND%d->SetLineColor(2);\nFOUND%d->Draw();\n",
10569  i-Nmin,z1,0.,z2, 2.*PI,i-Nmin,i-Nmin);
10570 
10571  } // end of for(i=Nmin; i<= Nmax;++)
10572 
10573 
10574 //--------------------------------------------- qui ci aggiungo le traccie MC
10575 
10576 
10577  for(imc=0; imc<nMCTracks ; imc++){
10578 
10579 
10580 
10581  Int_t icode;
10582  Double_t Rr, Dd, Fifi, Oxx, Oyy, Cx, Cy, Px, Py, carica, FI0mc ;
10583  PndMCTrack* pMC;
10584  pMC = (PndMCTrack*) fMCTrackArray->At(imc);
10585  if ( ! pMC ) continue ;
10586  icode = pMC->GetPdgCode() ; // PDG code of track
10587  Oxx = pMC->GetStartVertex().X(); // X of starting point track
10588  Oyy = pMC->GetStartVertex().Y(); // Y of starting point track
10589  Px = pMC->GetMomentum().X();
10590  Py = pMC->GetMomentum().Y();
10591  aaa = sqrt( Px*Px + Py*Py);
10592  Rr = aaa*1000./(BFIELD*CVEL); // R (cm) of Helix of track projected in XY plane; B = 2 Tesla
10593  TDatabasePDG *fdbPDG= TDatabasePDG::Instance();
10594  TParticlePDG *fParticle= fdbPDG->GetParticle(icode);
10595  if (icode>1000000000) carica = 1.;
10596  else carica = fParticle->Charge()/3. ; // charge of track
10597  if( fabs(carica)<0.1) continue;
10598  Cx = Oxx + Py*1000./(BFIELD*CVEL*carica);
10599  Cy = Oyy - Px*1000./(BFIELD*CVEL*carica);
10600  if( fabs( pMC->GetMomentum().Z() )< 1.e-20) KAPPA = 99999999.;
10601  else KAPPA = -carica*0.001*BFIELD*CVEL/pMC->GetMomentum().Z();
10602  FI0mc = fmod(Fifi+ PI, 2.*PI);
10603 // KAPPA=MCtruthTrkInfo[12][imc];
10604  FI0 = FI0mc;
10605 
10606 
10607  if ( KAPPA >= 0.) {
10608  fmin = KAPPA*zmin + FI0;
10609  fmax = KAPPA*zmax + FI0;
10610  } else {
10611  fmax = KAPPA*zmin + FI0;
10612  fmin = KAPPA*zmax + FI0;
10613  }
10614  if( fmax>=0.) {
10615  Nmax = (int) (0.5*fmax/ PI);
10616  } else {
10617  Nmax = ( (int) (0.5*fmax/ PI) ) -1;
10618  }
10619  if( fmin>=0.) {
10620  Nmin = (int) (0.5*fmin/ PI);
10621  } else {
10622  Nmin = ((int) (0.5*fmin/ PI) )-1;
10623  }
10624  for(i=Nmin; i<= Nmax;i++){
10625  offset = 2.*PI*i;
10626  z1 = (i*2.*PI-FI0)/KAPPA;
10627  z2 = ((i+1)*2.*PI-FI0)/KAPPA;
10628  fprintf(MACRO,"TLine* MC%d_%d = new TLine(%f,%f,%f,%f);\nMC%d_%d->SetLineColor(3);\nMC%d_%d->Draw();\n",
10629  imc,i-Nmin,z1,0.,z2, 2.*PI,imc,i-Nmin,imc,i-Nmin);
10630 
10631  } // end of for(i=Nmin; i<= Nmax;++)
10632 
10633 
10634  } // end of for(imc=0; imc<nMCTracks ; imc++)
10635 
10636 
10637 
10638 
10639 
10640 
10641 
10642  } // end of if(index!=0 && zmax >= zmin && Smax >= Smin )
10643 
10644 
10645  fprintf(MACRO,"}\n");
10646  fclose(MACRO);
10647 
10648 
10649 
10650 
10651 
10652  }
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double dy
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
Double_t xmax
TVector3 GetMomentum() const
Definition: PndMCTrack.h:78
TVector3 offset(2, 0, 0)
void calculateintersections(Double_t Ox, Double_t Oy, Double_t R, 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)
Int_t * fParticle
Definition: run_full.C:24
Double_t
const Double_t zpos
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
static const Double_t PI
static const Double_t CVEL
Double_t xmin
TVector3 GetStartVertex() const
Definition: PndMCTrack.h:76
Double_t angle
static const Double_t BFIELD
Double_t R
Definition: checkhelixhit.C:61

Member Data Documentation

Double_t PndSttTrackFinderReal::ALFA[MAXTRACKSPEREVENT]
private
const Double_t PndSttTrackFinderReal::ApotemaMaxInnerParStraw = 23.246827
staticprivate

Definition at line 116 of file PndSttTrackFinderReal.h.

Referenced by SeparateInnerOuterParallel().

const Double_t PndSttTrackFinderReal::ApotemaMaxSkewStraw = 31.517569
staticprivate

Definition at line 118 of file PndSttTrackFinderReal.h.

Referenced by FindTrackInXYProjection().

const Double_t PndSttTrackFinderReal::ApotemaMinOuterParStraw = 31.863369
staticprivate

Definition at line 119 of file PndSttTrackFinderReal.h.

const Double_t PndSttTrackFinderReal::ApotemaMinSkewStraw = 23.246827
staticprivate

Definition at line 117 of file PndSttTrackFinderReal.h.

Double_t PndSttTrackFinderReal::BETA[MAXTRACKSPEREVENT]
private
const Double_t PndSttTrackFinderReal::BFIELD =2.
staticprivate
const Double_t PndSttTrackFinderReal::CVEL = 2.99792
staticprivate
const Double_t PndSttTrackFinderReal::CXmax =150.
staticprivate
Double_t PndSttTrackFinderReal::CxMC[MAXTRACKSPEREVENT]
private
const Double_t PndSttTrackFinderReal::CXmin =-150.
staticprivate
const Double_t PndSttTrackFinderReal::CYmax =300.
staticprivate
Double_t PndSttTrackFinderReal::CyMC[MAXTRACKSPEREVENT]
private

Definition at line 196 of file PndSttTrackFinderReal.h.

Referenced by Initialization_ClassVariables().

const Double_t PndSttTrackFinderReal::CYmin =-300.
staticprivate
const Double_t PndSttTrackFinderReal::DELTA_D =2.
staticprivate

Definition at line 136 of file PndSttTrackFinderReal.h.

const Double_t PndSttTrackFinderReal::DELTA_Fi =0.3
staticprivate

Definition at line 135 of file PndSttTrackFinderReal.h.

const Double_t PndSttTrackFinderReal::DELTA_FI0 = 0.3
staticprivate

Definition at line 138 of file PndSttTrackFinderReal.h.

Referenced by PndSttTrackFinderReal().

const Double_t PndSttTrackFinderReal::DELTA_KAPPA =0.03
staticprivate

Definition at line 137 of file PndSttTrackFinderReal.h.

Referenced by PndSttTrackFinderReal().

const Double_t PndSttTrackFinderReal::DELTA_R =5.
staticprivate

Definition at line 134 of file PndSttTrackFinderReal.h.

const Short_t PndSttTrackFinderReal::DELTAnR = 2
staticprivate
const Double_t PndSttTrackFinderReal::DIMENSIONSCITIL =2.85
staticprivate
const Double_t PndSttTrackFinderReal::Dmax =21.
staticprivate

Definition at line 131 of file PndSttTrackFinderReal.h.

Referenced by plottamentiParalleleGenerali(), and PndSttTrackFinderReal().

const Double_t PndSttTrackFinderReal::Dmin =-21.
staticprivate

Definition at line 131 of file PndSttTrackFinderReal.h.

Referenced by plottamentiParalleleGenerali(), and PndSttTrackFinderReal().

bool PndSttTrackFinderReal::doMcComparison
private
Bool_t PndSttTrackFinder::fHelixHitProduction
protectedinherited

production to file of helix hit from PR or not

Definition at line 76 of file PndSttTrackFinder.h.

Referenced by PndSttTrackFinderIdeal::DoFind(), Init(), PndSttTrackFinderIdeal::PndSttTrackFinderIdeal(), and PndSttTrackFinder::SetHelixHitProduction().

TList PndSttTrackFinderReal::fHitCollectionList
private
Double_t PndSttTrackFinderReal::FI0max
private
Double_t PndSttTrackFinderReal::FI0min
private
Double_t PndSttTrackFinderReal::Fimax
private
Double_t PndSttTrackFinderReal::Fimin
private

Definition at line 196 of file PndSttTrackFinderReal.h.

Referenced by plottamentiParalleleGenerali(), and PndSttTrackFinderReal().

TClonesArray* PndSttTrackFinderReal::fMCTrackArray
private
TList PndSttTrackFinderReal::fPointCollectionList
private

Definition at line 233 of file PndSttTrackFinderReal.h.

Referenced by AddHitCollection(), DoFind(), and GetPointFromCollections().

TClonesArray * PndSttTrackFinderReal::fSciTHitArray
private

Definition at line 219 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

TClonesArray * PndSttTrackFinderReal::fSciTPointArray
private

Definition at line 219 of file PndSttTrackFinderReal.h.

Referenced by Initialization_ClassVariables().

char PndSttTrackFinderReal::fSttBranch[100]
private

Branch name to be used to fetch the hits of the backgound mixed events

Definition at line 241 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), PndSttTrackFinderReal(), and SetInputBranchName().

TClonesArray* PndSttTrackFinderReal::fSttHitArray
private

Definition at line 237 of file PndSttTrackFinderReal.h.

Referenced by Initialization_ClassVariables().

TClonesArray* PndSttTrackFinderReal::fTubeArray
private

Definition at line 223 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and SetTubeArray().

Int_t PndSttTrackFinder::fVerbose
protectedinherited
Double_t PndSttTrackFinderReal::GAMMA[MAXTRACKSPEREVENT]
private
FILE* PndSttTrackFinderReal::HANDLE
private

Definition at line 169 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

FILE* PndSttTrackFinderReal::HANDLE2
private

Definition at line 170 of file PndSttTrackFinderReal.h.

Referenced by Init(), and Initialization_ClassVariables().

FILE* PndSttTrackFinderReal::HANDLEXYZ
private

Definition at line 171 of file PndSttTrackFinderReal.h.

Referenced by Init(), and Initialization_ClassVariables().

TH1F* PndSttTrackFinderReal::hdist
private

Definition at line 165 of file PndSttTrackFinderReal.h.

Referenced by Init(), Initialization_ClassVariables(), and WriteHistograms().

TH1F * PndSttTrackFinderReal::hdistbadlast
private

Definition at line 165 of file PndSttTrackFinderReal.h.

Referenced by Init(), Initialization_ClassVariables(), and WriteHistograms().

TH1F * PndSttTrackFinderReal::hdistgoodlast
private

Definition at line 165 of file PndSttTrackFinderReal.h.

Referenced by Init(), Initialization_ClassVariables(), and WriteHistograms().

bool PndSttTrackFinderReal::InclusionListSciTil[nmaxSciTilHits]
private
Short_t PndSttTrackFinderReal::infoparal[nmaxHits]
private
Short_t PndSttTrackFinderReal::infoskew[nmaxHits]
private
bool PndSttTrackFinderReal::iplotta
private

Definition at line 158 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), PndSttTrackFinderReal(), and WriteHistograms().

int PndSttTrackFinderReal::istampa
private
int PndSttTrackFinderReal::IVOLTE
private
const Double_t PndSttTrackFinderReal::KAPPAmax = 2.
staticprivate

Definition at line 132 of file PndSttTrackFinderReal.h.

Referenced by PndSttTrackFinderReal().

const Double_t PndSttTrackFinderReal::KAPPAmin =-2.
staticprivate

Definition at line 132 of file PndSttTrackFinderReal.h.

Referenced by PndSttTrackFinderReal().

Short_t PndSttTrackFinderReal::ListSciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHitsinTrack]
private
const Short_t PndSttTrackFinderReal::MAXElementsOverThresholdinHough = 500
staticprivate

Definition at line 109 of file PndSttTrackFinderReal.h.

const Short_t PndSttTrackFinderReal::MAXHITSINCELL =50
staticprivate

Definition at line 96 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and PndSttBoxConformalFilling().

const Short_t PndSttTrackFinderReal::MAXMCTRACKS =10000
staticprivate

Definition at line 94 of file PndSttTrackFinderReal.h.

Referenced by DoFind().

const Short_t PndSttTrackFinderReal::MAXTRACKSPEREVENT =50
staticprivate

Definition at line 95 of file PndSttTrackFinderReal.h.

Referenced by DoFind().

const Short_t PndSttTrackFinderReal::MINIMUMCOUNTSDFiR = 18
staticprivate

Definition at line 107 of file PndSttTrackFinderReal.h.

const Short_t PndSttTrackFinderReal::MINIMUMCOUNTSKAPPAFI0 = 5
staticprivate

Definition at line 108 of file PndSttTrackFinderReal.h.

Short_t PndSttTrackFinderReal::MINIMUMHITSPERTRACK
private
Short_t PndSttTrackFinderReal::MINIMUMOUTERHITSPERTRACK
private

Definition at line 181 of file PndSttTrackFinderReal.h.

Referenced by FindTrackInXYProjection(), and PndSttTrackFinderReal().

const Short_t PndSttTrackFinderReal::nAdmittedRadia = 3
staticprivate

Definition at line 98 of file PndSttTrackFinderReal.h.

const Short_t PndSttTrackFinderReal::nbinCX =100
staticprivate
const Short_t PndSttTrackFinderReal::nbinCY = 100
staticprivate
const Short_t PndSttTrackFinderReal::nbinD = 250
staticprivate
const Short_t PndSttTrackFinderReal::nbinFi = 250
staticprivate
const Short_t PndSttTrackFinderReal::nbinFI0 = 200
staticprivate

Definition at line 106 of file PndSttTrackFinderReal.h.

Referenced by PndSttTrackFinderReal().

const Short_t PndSttTrackFinderReal::nbinKAPPA = 200
staticprivate

Definition at line 105 of file PndSttTrackFinderReal.h.

Referenced by PndSttTrackFinderReal().

const Short_t PndSttTrackFinderReal::nbinR = 100
staticprivate
const Short_t PndSttTrackFinderReal::nbinZ = 100
staticprivate

Definition at line 101 of file PndSttTrackFinderReal.h.

const Short_t PndSttTrackFinderReal::nFidivConformal = (Short_t) (3.141592654 * 45./0.5)
staticprivate
const Short_t PndSttTrackFinderReal::NHITSINFIT =15
staticprivate

Definition at line 111 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and FindTrackInXYProjection().

Short_t PndSttTrackFinderReal::nHitsInMCTrack[MAXTRACKSPEREVENT]
private

Definition at line 181 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and Initialization_ClassVariables().

const int PndSttTrackFinderReal::nmassimo =50
staticprivate
const Short_t PndSttTrackFinderReal::nmaxHits = 1000
staticprivate
const Short_t PndSttTrackFinderReal::nmaxHitsInTrack =60
staticprivate

Definition at line 91 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and PndSttFindTrackPatterninBoxConformal().

const Short_t PndSttTrackFinderReal::nmaxinclinationversors =20
staticprivate

Definition at line 97 of file PndSttTrackFinderReal.h.

Referenced by DoFind().

const Short_t PndSttTrackFinderReal::nmaxSciTilHits = 200
staticprivate
const Short_t PndSttTrackFinderReal::nmaxSciTilHitsinTrack = 2
staticprivate

Definition at line 93 of file PndSttTrackFinderReal.h.

Referenced by AssociateSciTilHit().

Short_t PndSttTrackFinderReal::nMCTracks
private
const Short_t PndSttTrackFinderReal::nRdivConformal =10
staticprivate
Short_t PndSttTrackFinderReal::nRdivConformalEffective
private
Short_t PndSttTrackFinderReal::nSciTilHits
private
Short_t PndSttTrackFinderReal::nSciTilHitsinTrack[MAXTRACKSPEREVENT]
private
Short_t PndSttTrackFinderReal::nSttSkewhit
private
Short_t PndSttTrackFinderReal::nSttSkewhitInMCTrack[MAXTRACKSPEREVENT]
private

Definition at line 181 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and Initialization_ClassVariables().

FILE* PndSttTrackFinderReal::PHANDLEX
private

Definition at line 172 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

FILE* PndSttTrackFinderReal::PHANDLEY
private

Definition at line 173 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

FILE* PndSttTrackFinderReal::PHANDLEZ
private

Definition at line 174 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

const Double_t PndSttTrackFinderReal::PI = 3.141592654
staticprivate
const Double_t PndSttTrackFinderReal::PMAX =100.
staticprivate

Definition at line 125 of file PndSttTrackFinderReal.h.

Referenced by DoFind().

PndMCTrack* PndSttTrackFinderReal::pMCtr
private

Definition at line 224 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and Initialization_ClassVariables().

Double_t PndSttTrackFinderReal::posizSciTil[nmaxSciTilHits][3]
private
Double_t PndSttTrackFinderReal::R_MC[MAXTRACKSPEREVENT]
private

Definition at line 196 of file PndSttTrackFinderReal.h.

Referenced by Initialization_ClassVariables().

Double_t PndSttTrackFinderReal::radiaConf[nRdivConformal]
private
const Double_t PndSttTrackFinderReal::Rmax =700.
staticprivate

Definition at line 124 of file PndSttTrackFinderReal.h.

Referenced by plottamentiParalleleGenerali(), and PndSttTrackFinderReal().

const Double_t PndSttTrackFinderReal::RMAXSCITIL = 50.
staticprivate
const Double_t PndSttTrackFinderReal::Rmin =20.
staticprivate

Definition at line 123 of file PndSttTrackFinderReal.h.

Referenced by plottamentiParalleleGenerali(), and PndSttTrackFinderReal().

const Double_t PndSttTrackFinderReal::RStrawDetectorMax = 40.73
staticprivate
const Double_t PndSttTrackFinderReal::RStrawDetectorMin = 16.119
staticprivate
Double_t PndSttTrackFinderReal::S_SciTilHitsinTrack[MAXTRACKSPEREVENT][nmaxSciTilHits]
private
Double_t PndSttTrackFinderReal::SEMILENGTH_STRAIGHT
private
FILE* PndSttTrackFinderReal::SHANDLEX
private

Definition at line 175 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

FILE* PndSttTrackFinderReal::SHANDLEY
private

Definition at line 176 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

FILE* PndSttTrackFinderReal::SHANDLEZ
private

Definition at line 177 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), Init(), and Initialization_ClassVariables().

const Double_t PndSttTrackFinderReal::SKEWinclination_DEGREES = 3.
staticprivate

Definition at line 128 of file PndSttTrackFinderReal.h.

Referenced by AssociateBetterAfterFitSkewHitsToXYTrack().

Double_t PndSttTrackFinderReal::stepD
private
Double_t PndSttTrackFinderReal::stepFi
private
Double_t PndSttTrackFinderReal::stepFI0
private
Double_t PndSttTrackFinderReal::stepfineFI0
private
Double_t PndSttTrackFinderReal::stepfineKAPPA
private
Double_t PndSttTrackFinderReal::stepKAPPA
private
Double_t PndSttTrackFinderReal::stepR
private
const Double_t PndSttTrackFinderReal::StrawDriftError = 0.02
staticprivate

Definition at line 127 of file PndSttTrackFinderReal.h.

Referenced by AssociateSkewHitsToXYTrack().

const Double_t PndSttTrackFinderReal::STRAWRADIUS = 0.5
staticprivate
const int PndSttTrackFinderReal::TIMEOUT =60
staticprivate

Definition at line 151 of file PndSttTrackFinderReal.h.

bool PndSttTrackFinderReal::TypeConf[MAXTRACKSPEREVENT]
private
Double_t PndSttTrackFinderReal::veritaMC[nmaxHits][3]
private

Definition at line 178 of file PndSttTrackFinderReal.h.

Referenced by DoFind(), and Initialization_ClassVariables().

const Double_t PndSttTrackFinderReal::VERTICALGAP = 4.
staticprivate

Definition at line 121 of file PndSttTrackFinderReal.h.

const bool PndSttTrackFinderReal::YesClean = false
staticprivate

Definition at line 143 of file PndSttTrackFinderReal.h.

bool PndSttTrackFinderReal::YesSciTil
private
Double_t PndSttTrackFinderReal::ZCENTER_STRAIGHT
private
const Double_t PndSttTrackFinderReal::Zmax = 75.
staticprivate

Definition at line 133 of file PndSttTrackFinderReal.h.

const Double_t PndSttTrackFinderReal::Zmin = -75.
staticprivate

Definition at line 133 of file PndSttTrackFinderReal.h.


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