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