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 "AliMUONConstants.h"
29 #include "Riostream.h"
32 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
35 //__________________________________________________________________________
36 AliMUONHitForRec::AliMUONHitForRec()
50 /// Default Constructor
54 //__________________________________________________________________________
55 AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit)
57 fBendingCoor(theGhit->Y()),
58 fNonBendingCoor(theGhit->X()),
69 /// Constructor for AliMUONHitForRec from a track ref. hit.
70 /// Fills the bending, non bending, and Z coordinates,
71 /// which are taken from the coordinates of the track ref. hit,
72 /// the track number (track ref. and not TH),
73 /// and the chamber number (0...).
75 // fTrack = theGhit->fTrack; ?????????
76 fDetElemId = theGhit->UserId();
77 if (fDetElemId) fChamberNumber = fDetElemId / 100 - 1;
78 else fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
79 // other fields will be updated in
80 // AliMUONEventReconstructor::NewHitForRecFromTrackRef
84 // //__________________________________________________________________________
85 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
87 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
88 // // Fills the bending and non bending coordinates.
89 // // Only the first correlation is taken into account.
90 // // The bending coordinate is taken from the first cathode.
91 // // The non bending coordinate is taken
92 // // from the second cathode if it exists,
93 // // from the first one otherwise.
94 // fBendingCoor = CathCorrel->fY[3];
95 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
96 // else fNonBendingCoor = CathCorrel->fX[3];
100 //__________________________________________________________________________
101 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
103 fBendingCoor(theRawCluster->GetY(0)),
104 fNonBendingCoor(theRawCluster->GetX(0)),
107 fNonBendingReso2(0.),
109 fDetElemId(theRawCluster->GetDetElemId()),
115 /// Constructor for AliMUONHitForRec from a raw cluster.
116 /// Fills the bending and non bending coordinates.
118 // other fields will be updated in
119 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
123 //__________________________________________________________________________
124 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
125 : TObject(theMUONHitForRec),
126 fBendingCoor(theMUONHitForRec.fBendingCoor),
127 fNonBendingCoor(theMUONHitForRec.fNonBendingCoor),
128 fZ(theMUONHitForRec.fZ),
129 fBendingReso2(theMUONHitForRec.fBendingReso2),
130 fNonBendingReso2(theMUONHitForRec.fNonBendingReso2),
131 fChamberNumber(theMUONHitForRec.fChamberNumber),
132 fDetElemId(theMUONHitForRec.fDetElemId),
133 fHitNumber(theMUONHitForRec.fHitNumber),
134 fTTRTrack(theMUONHitForRec.fTTRTrack),
135 fTrackRefSignal(theMUONHitForRec.fTrackRefSignal),
136 fNTrackHits(theMUONHitForRec.fNTrackHits)
142 //__________________________________________________________________________
143 AliMUONHitForRec::~AliMUONHitForRec()
148 //__________________________________________________________________________
149 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
151 /// Assignment operator
153 fBendingCoor = theMUONHitForRec.fBendingCoor;
154 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
155 fZ = theMUONHitForRec.fZ;
156 fBendingReso2 = theMUONHitForRec.fBendingReso2;
157 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
158 fChamberNumber = theMUONHitForRec.fChamberNumber;
159 fDetElemId = theMUONHitForRec.fDetElemId;
160 fHitNumber = theMUONHitForRec.fHitNumber;
161 fTTRTrack = theMUONHitForRec.fTTRTrack;
162 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
163 fNTrackHits = theMUONHitForRec.fNTrackHits;
166 //__________________________________________________________________________
168 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
170 // "Compare" function to sort with increasing chamber number.
171 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
172 // is smaller than (equal to, larger than) ChamberNumber of Hit
173 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
174 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
178 //__________________________________________________________________________
179 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
181 /// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
182 /// Returns 1 (0, -1) if Z-coordinate of current HitForRec
183 /// is smaller than (equal to, larger than) Z-coordinate of Hit
185 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
186 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
190 //__________________________________________________________________________
191 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
193 /// Calculate the normalized Chi2 between the current hitForRec (this) and the hitForRec pointed to by "hitForRec",
194 /// i.e. the square deviations between the coordinates, in both the bending and the non bending plane,
195 /// divided by the variance of the same quantities and by "Sigma2Cut".
196 /// Returns 3 if none of the 2 quantities is OK, something smaller than or equal to 2 otherwise.
197 /// Would it be more correct to use a real chi square including the non diagonal term ????
199 Double_t chi2, chi2Max, diff, normDiff;
202 // coordinate in bending plane
203 diff = fBendingCoor - hitForRec->fBendingCoor;
204 normDiff = diff * diff / (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
205 if (normDiff > 1.0) return chi2Max;
206 chi2 = chi2 + normDiff;
207 // coordinate in non bending plane
208 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
209 normDiff = diff * diff / (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
210 if (normDiff > 1.0) return chi2Max;
211 chi2 = chi2 + normDiff;
215 //______________________________________________________________________________
217 AliMUONHitForRec::Print(Option_t* /*opt*/) const
221 cout << "<AliMUONHitForRec> Coordinates (B,NB,Z) = ("
222 << setw(8) << setprecision(5) << fBendingCoor
223 << "," << setw(8) << setprecision(5) << fNonBendingCoor << ","
224 << setw(8) << setprecision(5) << fZ << ") "
225 << "Reso (B,NB)=(" << setw(8) << setprecision(5) << TMath::Sqrt(fBendingReso2)
226 << "," << setw(8) << setprecision(5) << TMath::Sqrt(fNonBendingReso2)
228 << "Number " << setw(3) << fHitNumber
229 << " within chamber " << setw(3) <<fChamberNumber
230 << " DE " << setw(4) << fDetElemId