]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitForRec.cxx
cleaning (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONHitForRec.cxx
CommitLineData
a9e2aefa 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
88cb7938 16/* $Id$ */
a9e2aefa 17
d19b6003 18// ------------------------
19// Class AliMUONHitForRec
20// ------------------------
a9e2aefa 21// Hit for reconstruction in ALICE dimuon spectrometer
d19b6003 22// Author: J. Gosset
a9e2aefa 23
29fc2c86 24#include "AliTrackReference.h"
a9e2aefa 25#include "AliMUONHitForRec.h"
a9e2aefa 26#include "AliMUONRawCluster.h"
27#include "AliMUONHit.h"
29fc2c86 28#include "AliMUONConstants.h"
8c343c7c 29#include "AliLog.h"
c8245e7e 30#include "Riostream.h"
a9e2aefa 31
7945aae7 32/// \cond CLASSIMP
a9e2aefa 33ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
7945aae7 34/// \endcond
a9e2aefa 35
36 //__________________________________________________________________________
30178c30 37AliMUONHitForRec::AliMUONHitForRec()
54d7ba50 38 : TObject(),
39 fBendingCoor(0.),
40 fNonBendingCoor(0.),
41 fZ(0.),
42 fBendingReso2(0.),
43 fNonBendingReso2(0.),
44 fChamberNumber(0),
45 fDetElemId(0),
46 fHitNumber(0),
47 fTTRTrack(0),
48 fTrackRefSignal(0),
49 fIndexOfFirstSegment(0),
50 fNSegments(0),
54d7ba50 51 fNTrackHits(0)
30178c30 52{
d19b6003 53/// Default Constructor
30178c30 54
30178c30 55}
56
57 //__________________________________________________________________________
29fc2c86 58AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit)
54d7ba50 59 : TObject(),
60 fBendingCoor(theGhit->Y()),
61 fNonBendingCoor(theGhit->X()),
62 fZ(theGhit->Z()),
63 fBendingReso2(0.),
64 fNonBendingReso2(0.),
65 fChamberNumber(0),
66 fDetElemId(0),
67 fHitNumber(0),
68 fTTRTrack(0),
69 fTrackRefSignal(0),
70 fIndexOfFirstSegment(-1),
71 fNSegments(0),
54d7ba50 72 fNTrackHits(0)
a9e2aefa 73{
d19b6003 74/// Constructor for AliMUONHitForRec from a track ref. hit.
75/// Fills the bending, non bending, and Z coordinates,
76/// which are taken from the coordinates of the track ref. hit,
77/// the track number (track ref. and not TH),
78/// and the chamber number (0...).
79
30178c30 80 // fTrack = theGhit->fTrack; ?????????
30d3ea8a 81 fDetElemId = theGhit->UserId();
82 if (fDetElemId) fChamberNumber = fDetElemId / 100 - 1;
83 else fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
a9e2aefa 84 // other fields will be updated in
54d7ba50 85 // AliMUONEventReconstructor::NewHitForRecFromTrackRef
a9e2aefa 86 return;
87}
88
89// //__________________________________________________________________________
90// AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
91// {
92// // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
93// // Fills the bending and non bending coordinates.
94// // Only the first correlation is taken into account.
95// // The bending coordinate is taken from the first cathode.
96// // The non bending coordinate is taken
97// // from the second cathode if it exists,
98// // from the first one otherwise.
99// fBendingCoor = CathCorrel->fY[3];
100// if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
101// else fNonBendingCoor = CathCorrel->fX[3];
102// return;
103// }
104
105 //__________________________________________________________________________
30178c30 106AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
54d7ba50 107 : TObject(),
108 fBendingCoor(theRawCluster->GetY(0)),
109 fNonBendingCoor(theRawCluster->GetX(0)),
110 fZ(0.),
111 fBendingReso2(0.),
112 fNonBendingReso2(0.),
113 fChamberNumber(0),
114 fDetElemId(theRawCluster->GetDetElemId()),
115 fHitNumber(0),
116 fTTRTrack(-1),
117 fTrackRefSignal(-1),
118 fIndexOfFirstSegment(-1),
119 fNSegments(0),
54d7ba50 120 fNTrackHits(0)
a9e2aefa 121{
d19b6003 122/// Constructor for AliMUONHitForRec from a raw cluster.
123/// Fills the bending and non bending coordinates.
124
a9e2aefa 125 // other fields will be updated in
126 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
a9e2aefa 127 return;
128}
129
30178c30 130 //__________________________________________________________________________
b8dc484b 131AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
54d7ba50 132 : TObject(theMUONHitForRec),
133 fBendingCoor(theMUONHitForRec.fBendingCoor),
134 fNonBendingCoor(theMUONHitForRec.fNonBendingCoor),
135 fZ(theMUONHitForRec.fZ),
136 fBendingReso2(theMUONHitForRec.fBendingReso2),
137 fNonBendingReso2(theMUONHitForRec.fNonBendingReso2),
138 fChamberNumber(theMUONHitForRec.fChamberNumber),
139 fDetElemId(theMUONHitForRec.fDetElemId),
140 fHitNumber(theMUONHitForRec.fHitNumber),
141 fTTRTrack(theMUONHitForRec.fTTRTrack),
142 fTrackRefSignal(theMUONHitForRec.fTrackRefSignal),
143 fIndexOfFirstSegment(theMUONHitForRec.fIndexOfFirstSegment),
144 fNSegments(theMUONHitForRec.fNSegments),
54d7ba50 145 fNTrackHits(theMUONHitForRec.fNTrackHits)
a9e2aefa 146{
d19b6003 147/// Copy constructor
148
a9e2aefa 149}
150
30178c30 151 //__________________________________________________________________________
b8dc484b 152AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
a9e2aefa 153{
d19b6003 154/// Assignment operator
155
b8dc484b 156 fBendingCoor = theMUONHitForRec.fBendingCoor;
157 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
158 fZ = theMUONHitForRec.fZ;
159 fBendingReso2 = theMUONHitForRec.fBendingReso2;
160 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
161 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 162 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 163 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 164 fTTRTrack = theMUONHitForRec.fTTRTrack;
165 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 166 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
167 fNSegments = theMUONHitForRec.fNSegments;
b8dc484b 168 fNTrackHits = theMUONHitForRec.fNTrackHits;
b8dc484b 169 return *this;
a9e2aefa 170}
a9e2aefa 171 //__________________________________________________________________________
83dbc640 172/*AZ
2a941f4e 173Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
a9e2aefa 174{
175 // "Compare" function to sort with increasing chamber number.
176 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
177 // is smaller than (equal to, larger than) ChamberNumber of Hit
178 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
179 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
180 else return(+1);
181}
83dbc640 182*/
183 //__________________________________________________________________________
184Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
185{
d19b6003 186/// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
187/// Returns 1 (0, -1) if Z-coordinate of current HitForRec
188/// is smaller than (equal to, larger than) Z-coordinate of Hit
189
5b64e914 190 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
83dbc640 191 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
5b64e914 192 else return(-1);
83dbc640 193}
a9e2aefa 194
195 //__________________________________________________________________________
30178c30 196Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
a9e2aefa 197{
d19b6003 198/// Calculate the normalized Chi2 between the current hitForRec (this)
199/// and the hitForRec pointed to by "hitForRec",
200/// i.e. the square deviations between the coordinates,
201/// in both the bending and the non bending plane,
202/// divided by the variance of the same quantities and by "Sigma2Cut".
203/// Returns 3 if none of the 2 quantities is OK,
204/// something smaller than or equal to 2 otherwise.
205/// Would it be more correct to use a real chi square
206/// including the non diagonal term ????
207
a9e2aefa 208 Double_t chi2, chi2Max, diff, normDiff;
209 chi2 = 0.0;
210 chi2Max = 3.0;
211 // coordinate in bending plane
30178c30 212 diff = fBendingCoor - hitForRec->fBendingCoor;
a9e2aefa 213 normDiff = diff * diff /
30178c30 214 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
a9e2aefa 215 if (normDiff > 1.0) return chi2Max;
216 chi2 = chi2 + normDiff;
217 // coordinate in non bending plane
30178c30 218 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
a9e2aefa 219 normDiff = diff * diff /
30178c30 220 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
a9e2aefa 221 if (normDiff > 1.0) return chi2Max;
222 chi2 = chi2 + normDiff;
223 return chi2;
224}
c8245e7e 225
226//______________________________________________________________________________
227void
228AliMUONHitForRec::Print(Option_t* /*opt*/) const
229{
9c4d2d12 230/// Printing
231
c8245e7e 232 cout << "<AliMUONHitForRec> Coordinates (B,NB,Z) = ("
233 << setw(8) << setprecision(5) << fBendingCoor
234 << "," << setw(8) << setprecision(5) << fNonBendingCoor << ","
235 << setw(8) << setprecision(5) << fZ << ") "
236 << "Reso (B,NB)=(" << setw(8) << setprecision(5) << TMath::Sqrt(fBendingReso2)
237 << "," << setw(8) << setprecision(5) << TMath::Sqrt(fNonBendingReso2)
238 << ") "
239 << "Number " << setw(3) << fHitNumber
240 << " within chamber " << setw(3) <<fChamberNumber
241 << " DE " << setw(4) << fDetElemId
242 << endl;
243}