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"
31 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
33 //__________________________________________________________________________
34 AliMUONHitForRec::AliMUONHitForRec()
46 fIndexOfFirstSegment(0),
48 fFirstTrackHitPtr(0x0),
49 fLastTrackHitPtr(0x0),
52 /// Default Constructor
56 //__________________________________________________________________________
57 AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit)
59 fBendingCoor(theGhit->Y()),
60 fNonBendingCoor(theGhit->X()),
69 fIndexOfFirstSegment(-1),
71 fFirstTrackHitPtr(0x0),
72 fLastTrackHitPtr(0x0),
75 /// Constructor for AliMUONHitForRec from a track ref. hit.
76 /// Fills the bending, non bending, and Z coordinates,
77 /// which are taken from the coordinates of the track ref. hit,
78 /// the track number (track ref. and not TH),
79 /// and the chamber number (0...).
81 // fTrack = theGhit->fTrack; ?????????
82 fDetElemId = theGhit->UserId();
83 if (fDetElemId) fChamberNumber = fDetElemId / 100 - 1;
84 else fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
85 // other fields will be updated in
86 // AliMUONEventReconstructor::NewHitForRecFromTrackRef
90 // //__________________________________________________________________________
91 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
93 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
94 // // Fills the bending and non bending coordinates.
95 // // Only the first correlation is taken into account.
96 // // The bending coordinate is taken from the first cathode.
97 // // The non bending coordinate is taken
98 // // from the second cathode if it exists,
99 // // from the first one otherwise.
100 // fBendingCoor = CathCorrel->fY[3];
101 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
102 // else fNonBendingCoor = CathCorrel->fX[3];
106 //__________________________________________________________________________
107 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
109 fBendingCoor(theRawCluster->GetY(0)),
110 fNonBendingCoor(theRawCluster->GetX(0)),
113 fNonBendingReso2(0.),
115 fDetElemId(theRawCluster->GetDetElemId()),
119 fIndexOfFirstSegment(-1),
121 fFirstTrackHitPtr(0x0),
122 fLastTrackHitPtr(0x0),
125 /// Constructor for AliMUONHitForRec from a raw cluster.
126 /// Fills the bending and non bending coordinates.
128 // other fields will be updated in
129 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
133 //__________________________________________________________________________
134 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
135 : TObject(theMUONHitForRec),
136 fBendingCoor(theMUONHitForRec.fBendingCoor),
137 fNonBendingCoor(theMUONHitForRec.fNonBendingCoor),
138 fZ(theMUONHitForRec.fZ),
139 fBendingReso2(theMUONHitForRec.fBendingReso2),
140 fNonBendingReso2(theMUONHitForRec.fNonBendingReso2),
141 fChamberNumber(theMUONHitForRec.fChamberNumber),
142 fDetElemId(theMUONHitForRec.fDetElemId),
143 fHitNumber(theMUONHitForRec.fHitNumber),
144 fTTRTrack(theMUONHitForRec.fTTRTrack),
145 fTrackRefSignal(theMUONHitForRec.fTrackRefSignal),
146 fIndexOfFirstSegment(theMUONHitForRec.fIndexOfFirstSegment),
147 fNSegments(theMUONHitForRec.fNSegments),
148 fFirstTrackHitPtr(theMUONHitForRec.fFirstTrackHitPtr),
149 fLastTrackHitPtr(theMUONHitForRec.fLastTrackHitPtr),
150 fNTrackHits(theMUONHitForRec.fNTrackHits)
156 //__________________________________________________________________________
157 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
159 /// Assignment operator
161 fBendingCoor = theMUONHitForRec.fBendingCoor;
162 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
163 fZ = theMUONHitForRec.fZ;
164 fBendingReso2 = theMUONHitForRec.fBendingReso2;
165 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
166 fChamberNumber = theMUONHitForRec.fChamberNumber;
167 fDetElemId = theMUONHitForRec.fDetElemId;
168 fHitNumber = theMUONHitForRec.fHitNumber;
169 fTTRTrack = theMUONHitForRec.fTTRTrack;
170 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
171 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
172 fNSegments = theMUONHitForRec.fNSegments;
173 fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr;
174 fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr;
175 fNTrackHits = theMUONHitForRec.fNTrackHits;
178 //__________________________________________________________________________
180 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
182 // "Compare" function to sort with increasing chamber number.
183 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
184 // is smaller than (equal to, larger than) ChamberNumber of Hit
185 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
186 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
190 //__________________________________________________________________________
191 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
193 /// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
194 /// Returns 1 (0, -1) if Z-coordinate of current HitForRec
195 /// is smaller than (equal to, larger than) Z-coordinate of Hit
197 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
198 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
202 //__________________________________________________________________________
203 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
205 /// Calculate the normalized Chi2 between the current hitForRec (this)
206 /// and the hitForRec pointed to by "hitForRec",
207 /// i.e. the square deviations between the coordinates,
208 /// in both the bending and the non bending plane,
209 /// divided by the variance of the same quantities and by "Sigma2Cut".
210 /// Returns 3 if none of the 2 quantities is OK,
211 /// something smaller than or equal to 2 otherwise.
212 /// Would it be more correct to use a real chi square
213 /// including the non diagonal term ????
215 Double_t chi2, chi2Max, diff, normDiff;
218 // coordinate in bending plane
219 diff = fBendingCoor - hitForRec->fBendingCoor;
220 normDiff = diff * diff /
221 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
222 if (normDiff > 1.0) return chi2Max;
223 chi2 = chi2 + normDiff;
224 // coordinate in non bending plane
225 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
226 normDiff = diff * diff /
227 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
228 if (normDiff > 1.0) return chi2Max;
229 chi2 = chi2 + normDiff;