]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitForRec.cxx
Runloader is updated when moving to next file (quick fix).
[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
71a2d3aa 141}
142
143 //__________________________________________________________________________
144AliMUONHitForRec::~AliMUONHitForRec()
145{
146/// Destructor
a9e2aefa 147}
148
30178c30 149 //__________________________________________________________________________
b8dc484b 150AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
a9e2aefa 151{
d19b6003 152/// Assignment operator
153
b8dc484b 154 fBendingCoor = theMUONHitForRec.fBendingCoor;
155 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
156 fZ = theMUONHitForRec.fZ;
157 fBendingReso2 = theMUONHitForRec.fBendingReso2;
158 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
159 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 160 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 161 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 162 fTTRTrack = theMUONHitForRec.fTTRTrack;
163 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 164 fNTrackHits = theMUONHitForRec.fNTrackHits;
b8dc484b 165 return *this;
a9e2aefa 166}
a9e2aefa 167 //__________________________________________________________________________
83dbc640 168/*AZ
2a941f4e 169Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
a9e2aefa 170{
171 // "Compare" function to sort with increasing chamber number.
172 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
173 // is smaller than (equal to, larger than) ChamberNumber of Hit
174 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
175 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
176 else return(+1);
177}
83dbc640 178*/
179 //__________________________________________________________________________
180Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
181{
d19b6003 182/// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
183/// Returns 1 (0, -1) if Z-coordinate of current HitForRec
184/// is smaller than (equal to, larger than) Z-coordinate of Hit
185
5b64e914 186 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
83dbc640 187 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
5b64e914 188 else return(-1);
83dbc640 189}
a9e2aefa 190
191 //__________________________________________________________________________
30178c30 192Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
a9e2aefa 193{
208f139e 194/// Calculate the normalized Chi2 between the current hitForRec (this) and the hitForRec pointed to by "hitForRec",
195/// i.e. the square deviations between the coordinates, in both the bending and the non bending plane,
d19b6003 196/// divided by the variance of the same quantities and by "Sigma2Cut".
208f139e 197/// Returns 3 if none of the 2 quantities is OK, something smaller than or equal to 2 otherwise.
198/// Would it be more correct to use a real chi square including the non diagonal term ????
d19b6003 199
a9e2aefa 200 Double_t chi2, chi2Max, diff, normDiff;
201 chi2 = 0.0;
202 chi2Max = 3.0;
203 // coordinate in bending plane
30178c30 204 diff = fBendingCoor - hitForRec->fBendingCoor;
208f139e 205 normDiff = diff * diff / (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
a9e2aefa 206 if (normDiff > 1.0) return chi2Max;
207 chi2 = chi2 + normDiff;
208 // coordinate in non bending plane
30178c30 209 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
208f139e 210 normDiff = diff * diff / (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
a9e2aefa 211 if (normDiff > 1.0) return chi2Max;
212 chi2 = chi2 + normDiff;
213 return chi2;
214}
c8245e7e 215
216//______________________________________________________________________________
217void
218AliMUONHitForRec::Print(Option_t* /*opt*/) const
219{
9c4d2d12 220/// Printing
221
c8245e7e 222 cout << "<AliMUONHitForRec> Coordinates (B,NB,Z) = ("
223 << setw(8) << setprecision(5) << fBendingCoor
224 << "," << setw(8) << setprecision(5) << fNonBendingCoor << ","
225 << setw(8) << setprecision(5) << fZ << ") "
226 << "Reso (B,NB)=(" << setw(8) << setprecision(5) << TMath::Sqrt(fBendingReso2)
227 << "," << setw(8) << setprecision(5) << TMath::Sqrt(fNonBendingReso2)
228 << ") "
229 << "Number " << setw(3) << fHitNumber
230 << " within chamber " << setw(3) <<fChamberNumber
231 << " DE " << setw(4) << fDetElemId
232 << endl;
233}