1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //__________________________________________________________________________
20 // Hit for reconstruction in ALICE dimuon spectrometer
21 //__________________________________________________________________________
23 #include "AliMUONHitForRec.h"
24 #include "AliMUONTrackParam.h"
25 #include "AliMUONRawCluster.h"
26 #include "AliMUONHit.h"
28 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
30 //__________________________________________________________________________
31 AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* Ghit)
33 // Constructor for AliMUONHitForRec from a GEANT hit.
34 // Fills the bending, non bending, and Z coordinates,
35 // which are taken from the coordinates of the GEANT hit,
36 // the track number (GEANT and not TH),
37 // and the chamber number (0...).
38 fBendingCoor = Ghit->Y();
39 fNonBendingCoor = Ghit->X();
41 // fTrack = Ghit->fTrack; ?????????
42 fChamberNumber = Ghit->Chamber() - 1;
43 // other fields will be updated in
44 // AliMUONEventReconstructor::NewHitForRecFromGEANT,
45 // except the following ones
46 fIndexOfFirstSegment = -1;
48 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
53 // //__________________________________________________________________________
54 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
56 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
57 // // Fills the bending and non bending coordinates.
58 // // Only the first correlation is taken into account.
59 // // The bending coordinate is taken from the first cathode.
60 // // The non bending coordinate is taken
61 // // from the second cathode if it exists,
62 // // from the first one otherwise.
63 // fBendingCoor = CathCorrel->fY[3];
64 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
65 // else fNonBendingCoor = CathCorrel->fX[3];
69 //__________________________________________________________________________
70 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* RawCluster)
72 // Constructor for AliMUONHitForRec from a raw cluster.
73 // Fills the bending and non bending coordinates.
74 fNonBendingCoor = RawCluster->fX[0];
75 fBendingCoor = RawCluster->fY[0];
76 // other fields will be updated in
77 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
78 // except the following ones
81 fIndexOfFirstSegment = -1;
83 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
88 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& MUONHitForRec):TObject(MUONHitForRec)
90 // Dummy copy constructor
93 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& /*MUONHitForRec*/)
95 // Dummy assignment operator
98 //__________________________________________________________________________
100 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
102 // "Compare" function to sort with increasing chamber number.
103 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
104 // is smaller than (equal to, larger than) ChamberNumber of Hit
105 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
106 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
110 //__________________________________________________________________________
111 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
113 // "Compare" function to sort with increasing Z-coordinate.
114 // Returns -1 (0, +1) if Z-coordinate of current HitForRec
115 // is smaller than (equal to, larger than) Z-coordinate of Hit
116 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(-1);
117 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
121 //__________________________________________________________________________
122 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* HitForRec, Double_t Sigma2Cut)
124 // Calculate the normalized Chi2 between the current HitForRec (this)
125 // and the HitForRec pointed to by "HitForRec",
126 // i.e. the square deviations between the coordinates,
127 // in both the bending and the non bending plane,
128 // divided by the variance of the same quantities and by "Sigma2Cut".
129 // Returns 3 if none of the 2 quantities is OK,
130 // something smaller than or equal to 2 otherwise.
131 // Would it be more correct to use a real chi square
132 // including the non diagonal term ????
133 Double_t chi2, chi2Max, diff, normDiff;
136 // coordinate in bending plane
137 diff = this->fBendingCoor - HitForRec->fBendingCoor;
138 normDiff = diff * diff /
139 (this->fBendingReso2 + HitForRec->fBendingReso2) / Sigma2Cut;
140 if (normDiff > 1.0) return chi2Max;
141 chi2 = chi2 + normDiff;
142 // coordinate in non bending plane
143 diff = this->fNonBendingCoor - HitForRec->fNonBendingCoor;
144 normDiff = diff * diff /
145 (this->fNonBendingReso2 + HitForRec->fNonBendingReso2) / Sigma2Cut;
146 if (normDiff > 1.0) return chi2Max;
147 chi2 = chi2 + normDiff;