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()
37 /// Default Constructor
39 fFirstTrackHitPtr = 0;
43 //__________________________________________________________________________
44 AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit)
47 /// Constructor for AliMUONHitForRec from a track ref. hit.
48 /// Fills the bending, non bending, and Z coordinates,
49 /// which are taken from the coordinates of the track ref. hit,
50 /// the track number (track ref. and not TH),
51 /// and the chamber number (0...).
53 fBendingCoor = theGhit->Y();
54 fNonBendingCoor = theGhit->X();
56 // fTrack = theGhit->fTrack; ?????????
57 fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
59 // other fields will be updated in
60 // AliMUONEventReconstructor::NewHitForRecFromTrackRef,
61 // except the following ones
62 fIndexOfFirstSegment = -1;
64 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
69 // //__________________________________________________________________________
70 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
72 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
73 // // Fills the bending and non bending coordinates.
74 // // Only the first correlation is taken into account.
75 // // The bending coordinate is taken from the first cathode.
76 // // The non bending coordinate is taken
77 // // from the second cathode if it exists,
78 // // from the first one otherwise.
79 // fBendingCoor = CathCorrel->fY[3];
80 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
81 // else fNonBendingCoor = CathCorrel->fX[3];
85 //__________________________________________________________________________
86 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
89 /// Constructor for AliMUONHitForRec from a raw cluster.
90 /// Fills the bending and non bending coordinates.
92 fNonBendingCoor = theRawCluster->GetX(0);
93 fBendingCoor = theRawCluster->GetY(0);
94 fDetElemId = theRawCluster->GetDetElemId();
95 // other fields will be updated in
96 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
97 // except the following ones
100 fIndexOfFirstSegment = -1;
102 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
107 //__________________________________________________________________________
108 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
109 : TObject(theMUONHitForRec)
113 fBendingCoor = theMUONHitForRec.fBendingCoor;
114 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
115 fZ = theMUONHitForRec.fZ;
116 fBendingReso2 = theMUONHitForRec.fBendingReso2;
117 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
118 fChamberNumber = theMUONHitForRec.fChamberNumber;
119 fDetElemId = theMUONHitForRec.fDetElemId;
120 fHitNumber = theMUONHitForRec.fHitNumber;
121 fTTRTrack = theMUONHitForRec.fTTRTrack;
122 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
123 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
124 fNSegments = theMUONHitForRec.fNSegments;
125 fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr;
126 fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr;
127 fNTrackHits = theMUONHitForRec.fNTrackHits;
130 //__________________________________________________________________________
131 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
133 /// Assignment operator
135 fBendingCoor = theMUONHitForRec.fBendingCoor;
136 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
137 fZ = theMUONHitForRec.fZ;
138 fBendingReso2 = theMUONHitForRec.fBendingReso2;
139 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
140 fChamberNumber = theMUONHitForRec.fChamberNumber;
141 fDetElemId = theMUONHitForRec.fDetElemId;
142 fHitNumber = theMUONHitForRec.fHitNumber;
143 fTTRTrack = theMUONHitForRec.fTTRTrack;
144 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
145 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
146 fNSegments = theMUONHitForRec.fNSegments;
147 fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr;
148 fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr;
149 fNTrackHits = theMUONHitForRec.fNTrackHits;
152 //__________________________________________________________________________
154 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
156 // "Compare" function to sort with increasing chamber number.
157 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
158 // is smaller than (equal to, larger than) ChamberNumber of Hit
159 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
160 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
164 //__________________________________________________________________________
165 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
167 /// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
168 /// Returns 1 (0, -1) if Z-coordinate of current HitForRec
169 /// is smaller than (equal to, larger than) Z-coordinate of Hit
171 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
172 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
176 //__________________________________________________________________________
177 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
179 /// Calculate the normalized Chi2 between the current hitForRec (this)
180 /// and the hitForRec pointed to by "hitForRec",
181 /// i.e. the square deviations between the coordinates,
182 /// in both the bending and the non bending plane,
183 /// divided by the variance of the same quantities and by "Sigma2Cut".
184 /// Returns 3 if none of the 2 quantities is OK,
185 /// something smaller than or equal to 2 otherwise.
186 /// Would it be more correct to use a real chi square
187 /// including the non diagonal term ????
189 Double_t chi2, chi2Max, diff, normDiff;
192 // coordinate in bending plane
193 diff = fBendingCoor - hitForRec->fBendingCoor;
194 normDiff = diff * diff /
195 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
196 if (normDiff > 1.0) return chi2Max;
197 chi2 = chi2 + normDiff;
198 // coordinate in non bending plane
199 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
200 normDiff = diff * diff /
201 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
202 if (normDiff > 1.0) return chi2Max;
203 chi2 = chi2 + normDiff;