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