1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 // Class AliMUONHitForRec
20 // ------------------------
21 // Hit for reconstruction in ALICE dimuon spectrometer
23 //-----------------------------------------------------------------------------
25 #include "AliMUONHitForRec.h"
26 #include "AliMUONVCluster.h"
27 #include "AliMUONConstants.h"
30 #include "Riostream.h"
33 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
36 //__________________________________________________________________________
37 AliMUONHitForRec::AliMUONHitForRec()
51 /// Default Constructor
55 //__________________________________________________________________________
56 AliMUONHitForRec::AliMUONHitForRec(AliMUONVCluster* theRawCluster)
58 fBendingCoor(theRawCluster->GetY()),
59 fNonBendingCoor(theRawCluster->GetX()),
64 fDetElemId(theRawCluster->GetDetElemId()),
70 /// Constructor for AliMUONHitForRec from a raw cluster.
71 /// Fills the bending and non bending coordinates.
73 // other fields will be updated in
74 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
78 //__________________________________________________________________________
79 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
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),
91 fNTrackHits(theMUONHitForRec.fNTrackHits)
97 //__________________________________________________________________________
98 AliMUONHitForRec::~AliMUONHitForRec()
103 //__________________________________________________________________________
104 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
106 /// Assignment operator
108 fBendingCoor = theMUONHitForRec.fBendingCoor;
109 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
110 fZ = theMUONHitForRec.fZ;
111 fBendingReso2 = theMUONHitForRec.fBendingReso2;
112 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
113 fChamberNumber = theMUONHitForRec.fChamberNumber;
114 fDetElemId = theMUONHitForRec.fDetElemId;
115 fHitNumber = theMUONHitForRec.fHitNumber;
116 fTTRTrack = theMUONHitForRec.fTTRTrack;
117 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
118 fNTrackHits = theMUONHitForRec.fNTrackHits;
121 //__________________________________________________________________________
123 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
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);
133 //__________________________________________________________________________
134 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
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
140 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
141 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
145 //__________________________________________________________________________
146 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
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,
150 /// divided by the variance of the same quantities and by "Sigma2Cut".
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 ????
154 Double_t chi2, chi2Max, diff, normDiff;
157 // coordinate in bending plane
158 diff = fBendingCoor - hitForRec->fBendingCoor;
159 normDiff = diff * diff / (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
160 if (normDiff > 1.0) return chi2Max;
161 chi2 = chi2 + normDiff;
162 // coordinate in non bending plane
163 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
164 normDiff = diff * diff / (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
165 if (normDiff > 1.0) return chi2Max;
166 chi2 = chi2 + normDiff;
170 //______________________________________________________________________________
172 AliMUONHitForRec::Print(Option_t* /*opt*/) const
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)
183 << "Number " << setw(3) << fHitNumber
184 << " within chamber " << setw(3) <<fChamberNumber
185 << " DE " << setw(4) << fDetElemId