]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitForRec.cxx
Initial version (Laurent)
[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
3d1463c8 18//-----------------------------------------------------------------------------
d19b6003 19// Class AliMUONHitForRec
20// ------------------------
a9e2aefa 21// Hit for reconstruction in ALICE dimuon spectrometer
d19b6003 22// Author: J. Gosset
3d1463c8 23//-----------------------------------------------------------------------------
a9e2aefa 24
25#include "AliMUONHitForRec.h"
2060b217 26#include "AliMUONVCluster.h"
29fc2c86 27#include "AliMUONConstants.h"
8c343c7c 28#include "AliLog.h"
2060b217 29#include "TMath.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 //__________________________________________________________________________
2060b217 56AliMUONHitForRec::AliMUONHitForRec(AliMUONVCluster* theRawCluster)
54d7ba50 57 : TObject(),
2060b217 58 fBendingCoor(theRawCluster->GetY()),
59 fNonBendingCoor(theRawCluster->GetX()),
54d7ba50 60 fZ(0.),
61 fBendingReso2(0.),
62 fNonBendingReso2(0.),
63 fChamberNumber(0),
64 fDetElemId(theRawCluster->GetDetElemId()),
65 fHitNumber(0),
66 fTTRTrack(-1),
67 fTrackRefSignal(-1),
54d7ba50 68 fNTrackHits(0)
a9e2aefa 69{
d19b6003 70/// Constructor for AliMUONHitForRec from a raw cluster.
71/// Fills the bending and non bending coordinates.
72
a9e2aefa 73 // other fields will be updated in
74 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
a9e2aefa 75 return;
76}
77
30178c30 78 //__________________________________________________________________________
b8dc484b 79AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
54d7ba50 80 : TObject(theMUONHitForRec),
81 fBendingCoor(theMUONHitForRec.fBendingCoor),
82 fNonBendingCoor(theMUONHitForRec.fNonBendingCoor),
83 fZ(theMUONHitForRec.fZ),
84 fBendingReso2(theMUONHitForRec.fBendingReso2),
85 fNonBendingReso2(theMUONHitForRec.fNonBendingReso2),
86 fChamberNumber(theMUONHitForRec.fChamberNumber),
87 fDetElemId(theMUONHitForRec.fDetElemId),
88 fHitNumber(theMUONHitForRec.fHitNumber),
89 fTTRTrack(theMUONHitForRec.fTTRTrack),
90 fTrackRefSignal(theMUONHitForRec.fTrackRefSignal),
54d7ba50 91 fNTrackHits(theMUONHitForRec.fNTrackHits)
a9e2aefa 92{
d19b6003 93/// Copy constructor
94
71a2d3aa 95}
96
97 //__________________________________________________________________________
98AliMUONHitForRec::~AliMUONHitForRec()
99{
100/// Destructor
a9e2aefa 101}
102
30178c30 103 //__________________________________________________________________________
b8dc484b 104AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
a9e2aefa 105{
d19b6003 106/// Assignment operator
107
b8dc484b 108 fBendingCoor = theMUONHitForRec.fBendingCoor;
109 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
110 fZ = theMUONHitForRec.fZ;
111 fBendingReso2 = theMUONHitForRec.fBendingReso2;
112 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
113 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 114 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 115 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 116 fTTRTrack = theMUONHitForRec.fTTRTrack;
117 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 118 fNTrackHits = theMUONHitForRec.fNTrackHits;
b8dc484b 119 return *this;
a9e2aefa 120}
a9e2aefa 121 //__________________________________________________________________________
83dbc640 122/*AZ
2a941f4e 123Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
a9e2aefa 124{
125 // "Compare" function to sort with increasing chamber number.
126 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
127 // is smaller than (equal to, larger than) ChamberNumber of Hit
128 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
129 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
130 else return(+1);
131}
83dbc640 132*/
133 //__________________________________________________________________________
134Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
135{
d19b6003 136/// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
137/// Returns 1 (0, -1) if Z-coordinate of current HitForRec
138/// is smaller than (equal to, larger than) Z-coordinate of Hit
139
5b64e914 140 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
83dbc640 141 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
5b64e914 142 else return(-1);
83dbc640 143}
a9e2aefa 144
145 //__________________________________________________________________________
30178c30 146Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
a9e2aefa 147{
208f139e 148/// Calculate the normalized Chi2 between the current hitForRec (this) and the hitForRec pointed to by "hitForRec",
149/// i.e. the square deviations between the coordinates, in both the bending and the non bending plane,
d19b6003 150/// divided by the variance of the same quantities and by "Sigma2Cut".
208f139e 151/// Returns 3 if none of the 2 quantities is OK, something smaller than or equal to 2 otherwise.
152/// Would it be more correct to use a real chi square including the non diagonal term ????
d19b6003 153
a9e2aefa 154 Double_t chi2, chi2Max, diff, normDiff;
155 chi2 = 0.0;
156 chi2Max = 3.0;
157 // coordinate in bending plane
30178c30 158 diff = fBendingCoor - hitForRec->fBendingCoor;
208f139e 159 normDiff = diff * diff / (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
a9e2aefa 160 if (normDiff > 1.0) return chi2Max;
161 chi2 = chi2 + normDiff;
162 // coordinate in non bending plane
30178c30 163 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
208f139e 164 normDiff = diff * diff / (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
a9e2aefa 165 if (normDiff > 1.0) return chi2Max;
166 chi2 = chi2 + normDiff;
167 return chi2;
168}
c8245e7e 169
170//______________________________________________________________________________
171void
172AliMUONHitForRec::Print(Option_t* /*opt*/) const
173{
9c4d2d12 174/// Printing
175
c8245e7e 176 cout << "<AliMUONHitForRec> Coordinates (B,NB,Z) = ("
177 << setw(8) << setprecision(5) << fBendingCoor
178 << "," << setw(8) << setprecision(5) << fNonBendingCoor << ","
179 << setw(8) << setprecision(5) << fZ << ") "
180 << "Reso (B,NB)=(" << setw(8) << setprecision(5) << TMath::Sqrt(fBendingReso2)
181 << "," << setw(8) << setprecision(5) << TMath::Sqrt(fNonBendingReso2)
182 << ") "
183 << "Number " << setw(3) << fHitNumber
184 << " within chamber " << setw(3) <<fChamberNumber
185 << " DE " << setw(4) << fDetElemId
186 << endl;
187}