]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitForRec.cxx
DP:Misalignment of CPV added
[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),
54d7ba50 49 fNTrackHits(0)
30178c30 50{
d19b6003 51/// Default Constructor
30178c30 52
30178c30 53}
54
55 //__________________________________________________________________________
29fc2c86 56AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit)
54d7ba50 57 : TObject(),
58 fBendingCoor(theGhit->Y()),
59 fNonBendingCoor(theGhit->X()),
60 fZ(theGhit->Z()),
61 fBendingReso2(0.),
62 fNonBendingReso2(0.),
63 fChamberNumber(0),
64 fDetElemId(0),
65 fHitNumber(0),
66 fTTRTrack(0),
67 fTrackRefSignal(0),
54d7ba50 68 fNTrackHits(0)
a9e2aefa 69{
d19b6003 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...).
75
30178c30 76 // fTrack = theGhit->fTrack; ?????????
30d3ea8a 77 fDetElemId = theGhit->UserId();
78 if (fDetElemId) fChamberNumber = fDetElemId / 100 - 1;
79 else fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
a9e2aefa 80 // other fields will be updated in
54d7ba50 81 // AliMUONEventReconstructor::NewHitForRecFromTrackRef
a9e2aefa 82 return;
83}
84
85// //__________________________________________________________________________
86// AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
87// {
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];
98// return;
99// }
100
101 //__________________________________________________________________________
30178c30 102AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
54d7ba50 103 : TObject(),
104 fBendingCoor(theRawCluster->GetY(0)),
105 fNonBendingCoor(theRawCluster->GetX(0)),
106 fZ(0.),
107 fBendingReso2(0.),
108 fNonBendingReso2(0.),
109 fChamberNumber(0),
110 fDetElemId(theRawCluster->GetDetElemId()),
111 fHitNumber(0),
112 fTTRTrack(-1),
113 fTrackRefSignal(-1),
54d7ba50 114 fNTrackHits(0)
a9e2aefa 115{
d19b6003 116/// Constructor for AliMUONHitForRec from a raw cluster.
117/// Fills the bending and non bending coordinates.
118
a9e2aefa 119 // other fields will be updated in
120 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
a9e2aefa 121 return;
122}
123
30178c30 124 //__________________________________________________________________________
b8dc484b 125AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
54d7ba50 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),
54d7ba50 137 fNTrackHits(theMUONHitForRec.fNTrackHits)
a9e2aefa 138{
d19b6003 139/// Copy constructor
140
a9e2aefa 141}
142
30178c30 143 //__________________________________________________________________________
b8dc484b 144AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
a9e2aefa 145{
d19b6003 146/// Assignment operator
147
b8dc484b 148 fBendingCoor = theMUONHitForRec.fBendingCoor;
149 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
150 fZ = theMUONHitForRec.fZ;
151 fBendingReso2 = theMUONHitForRec.fBendingReso2;
152 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
153 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 154 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 155 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 156 fTTRTrack = theMUONHitForRec.fTTRTrack;
157 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 158 fNTrackHits = theMUONHitForRec.fNTrackHits;
b8dc484b 159 return *this;
a9e2aefa 160}
a9e2aefa 161 //__________________________________________________________________________
83dbc640 162/*AZ
2a941f4e 163Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
a9e2aefa 164{
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);
170 else return(+1);
171}
83dbc640 172*/
173 //__________________________________________________________________________
174Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
175{
d19b6003 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
179
5b64e914 180 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
83dbc640 181 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
5b64e914 182 else return(-1);
83dbc640 183}
a9e2aefa 184
185 //__________________________________________________________________________
30178c30 186Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
a9e2aefa 187{
208f139e 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,
d19b6003 190/// divided by the variance of the same quantities and by "Sigma2Cut".
208f139e 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 ????
d19b6003 193
a9e2aefa 194 Double_t chi2, chi2Max, diff, normDiff;
195 chi2 = 0.0;
196 chi2Max = 3.0;
197 // coordinate in bending plane
30178c30 198 diff = fBendingCoor - hitForRec->fBendingCoor;
208f139e 199 normDiff = diff * diff / (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
a9e2aefa 200 if (normDiff > 1.0) return chi2Max;
201 chi2 = chi2 + normDiff;
202 // coordinate in non bending plane
30178c30 203 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
208f139e 204 normDiff = diff * diff / (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
a9e2aefa 205 if (normDiff > 1.0) return chi2Max;
206 chi2 = chi2 + normDiff;
207 return chi2;
208}
c8245e7e 209
210//______________________________________________________________________________
211void
212AliMUONHitForRec::Print(Option_t* /*opt*/) const
213{
9c4d2d12 214/// Printing
215
c8245e7e 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)
222 << ") "
223 << "Number " << setw(3) << fHitNumber
224 << " within chamber " << setw(3) <<fChamberNumber
225 << " DE " << setw(4) << fDetElemId
226 << endl;
227}