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 // ------------------------
19 // Class AliMUONHitForRec
20 // ------------------------
21 // Hit for reconstruction in ALICE dimuon spectrometer
24 #include "AliTrackReference.h"
25 #include "AliMUONHitForRec.h"
26 #include "AliMUONRawCluster.h"
27 #include "AliMUONHit.h"
28 #include "AliMUONConstants.h"
30 #include "Riostream.h"
33 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
36 //__________________________________________________________________________
37 AliMUONHitForRec::AliMUONHitForRec()
51 /// Default Constructor
55 //__________________________________________________________________________
56 AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit)
58 fBendingCoor(theGhit->Y()),
59 fNonBendingCoor(theGhit->X()),
70 /// Constructor for AliMUONHitForRec from a track ref. hit.
71 /// Fills the bending, non bending, and Z coordinates,
72 /// which are taken from the coordinates of the track ref. hit,
73 /// the track number (track ref. and not TH),
74 /// and the chamber number (0...).
76 // fTrack = theGhit->fTrack; ?????????
77 fDetElemId = theGhit->UserId();
78 if (fDetElemId) fChamberNumber = fDetElemId / 100 - 1;
79 else fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
80 // other fields will be updated in
81 // AliMUONEventReconstructor::NewHitForRecFromTrackRef
85 // //__________________________________________________________________________
86 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
88 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
89 // // Fills the bending and non bending coordinates.
90 // // Only the first correlation is taken into account.
91 // // The bending coordinate is taken from the first cathode.
92 // // The non bending coordinate is taken
93 // // from the second cathode if it exists,
94 // // from the first one otherwise.
95 // fBendingCoor = CathCorrel->fY[3];
96 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
97 // else fNonBendingCoor = CathCorrel->fX[3];
101 //__________________________________________________________________________
102 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
104 fBendingCoor(theRawCluster->GetY(0)),
105 fNonBendingCoor(theRawCluster->GetX(0)),
108 fNonBendingReso2(0.),
110 fDetElemId(theRawCluster->GetDetElemId()),
116 /// Constructor for AliMUONHitForRec from a raw cluster.
117 /// Fills the bending and non bending coordinates.
119 // other fields will be updated in
120 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
124 //__________________________________________________________________________
125 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
126 : TObject(theMUONHitForRec),
127 fBendingCoor(theMUONHitForRec.fBendingCoor),
128 fNonBendingCoor(theMUONHitForRec.fNonBendingCoor),
129 fZ(theMUONHitForRec.fZ),
130 fBendingReso2(theMUONHitForRec.fBendingReso2),
131 fNonBendingReso2(theMUONHitForRec.fNonBendingReso2),
132 fChamberNumber(theMUONHitForRec.fChamberNumber),
133 fDetElemId(theMUONHitForRec.fDetElemId),
134 fHitNumber(theMUONHitForRec.fHitNumber),
135 fTTRTrack(theMUONHitForRec.fTTRTrack),
136 fTrackRefSignal(theMUONHitForRec.fTrackRefSignal),
137 fNTrackHits(theMUONHitForRec.fNTrackHits)
143 //__________________________________________________________________________
144 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
146 /// Assignment operator
148 fBendingCoor = theMUONHitForRec.fBendingCoor;
149 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
150 fZ = theMUONHitForRec.fZ;
151 fBendingReso2 = theMUONHitForRec.fBendingReso2;
152 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
153 fChamberNumber = theMUONHitForRec.fChamberNumber;
154 fDetElemId = theMUONHitForRec.fDetElemId;
155 fHitNumber = theMUONHitForRec.fHitNumber;
156 fTTRTrack = theMUONHitForRec.fTTRTrack;
157 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
158 fNTrackHits = theMUONHitForRec.fNTrackHits;
161 //__________________________________________________________________________
163 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
165 // "Compare" function to sort with increasing chamber number.
166 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
167 // is smaller than (equal to, larger than) ChamberNumber of Hit
168 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
169 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
173 //__________________________________________________________________________
174 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
176 /// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
177 /// Returns 1 (0, -1) if Z-coordinate of current HitForRec
178 /// is smaller than (equal to, larger than) Z-coordinate of Hit
180 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
181 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
185 //__________________________________________________________________________
186 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
188 /// Calculate the normalized Chi2 between the current hitForRec (this) and the hitForRec pointed to by "hitForRec",
189 /// i.e. the square deviations between the coordinates, in both the bending and the non bending plane,
190 /// divided by the variance of the same quantities and by "Sigma2Cut".
191 /// Returns 3 if none of the 2 quantities is OK, something smaller than or equal to 2 otherwise.
192 /// Would it be more correct to use a real chi square including the non diagonal term ????
194 Double_t chi2, chi2Max, diff, normDiff;
197 // coordinate in bending plane
198 diff = fBendingCoor - hitForRec->fBendingCoor;
199 normDiff = diff * diff / (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
200 if (normDiff > 1.0) return chi2Max;
201 chi2 = chi2 + normDiff;
202 // coordinate in non bending plane
203 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
204 normDiff = diff * diff / (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
205 if (normDiff > 1.0) return chi2Max;
206 chi2 = chi2 + normDiff;
210 //______________________________________________________________________________
212 AliMUONHitForRec::Print(Option_t* /*opt*/) const
216 cout << "<AliMUONHitForRec> Coordinates (B,NB,Z) = ("
217 << setw(8) << setprecision(5) << fBendingCoor
218 << "," << setw(8) << setprecision(5) << fNonBendingCoor << ","
219 << setw(8) << setprecision(5) << fZ << ") "
220 << "Reso (B,NB)=(" << setw(8) << setprecision(5) << TMath::Sqrt(fBendingReso2)
221 << "," << setw(8) << setprecision(5) << TMath::Sqrt(fNonBendingReso2)
223 << "Number " << setw(3) << fHitNumber
224 << " within chamber " << setw(3) <<fChamberNumber
225 << " DE " << setw(4) << fDetElemId