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