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