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