]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONHitForRec.cxx
Logging of Debug, Info and Error Messages follwing AliRoot Standard http://aliweb...
[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 //
20 // Hit for reconstruction in ALICE dimuon spectrometer
21 //__________________________________________________________________________
22
23 #include "AliMUONHitForRec.h" 
24 #include "AliMUONRawCluster.h"
25 #include "AliMUONHit.h"
26 #include "AliLog.h"
27
28 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
29
30   //__________________________________________________________________________
31 AliMUONHitForRec::AliMUONHitForRec()
32   : TObject()
33 {
34  // Default Constructor
35  
36     fFirstTrackHitPtr = 0;
37     fLastTrackHitPtr = 0;
38 }
39
40   //__________________________________________________________________________
41 AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* theGhit)
42   : TObject()
43 {
44   // Constructor for AliMUONHitForRec from a GEANT hit.
45   // Fills the bending, non bending, and Z coordinates,
46   // which are taken from the coordinates of the GEANT hit,
47   // the track number (GEANT and not TH),
48   // and the chamber number (0...).
49   fBendingCoor = theGhit->Y();
50   fNonBendingCoor = theGhit->X();
51   fZ = theGhit->Z();
52   // fTrack = theGhit->fTrack; ?????????
53   fChamberNumber = theGhit->Chamber() - 1;
54   // other fields will be updated in
55   // AliMUONEventReconstructor::NewHitForRecFromGEANT,
56   // except the following ones
57   fIndexOfFirstSegment = -1;
58   fNSegments = 0;
59   fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
60   fNTrackHits = 0;
61   return;
62 }
63
64 //   //__________________________________________________________________________
65 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
66 // {
67 //   // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
68 //   // Fills the bending and non bending coordinates.
69 //   // Only the first correlation is taken into account.
70 //   // The bending coordinate is taken from the first cathode.
71 //   // The non bending coordinate is taken 
72 //   // from the second cathode if it exists,
73 //   // from the first one otherwise.
74 //   fBendingCoor = CathCorrel->fY[3];
75 //   if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
76 //   else fNonBendingCoor = CathCorrel->fX[3];
77 //   return;
78 // }
79
80   //__________________________________________________________________________
81 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
82   : TObject()
83 {
84   // Constructor for AliMUONHitForRec from a raw cluster.
85   // Fills the bending and non bending coordinates.
86   fNonBendingCoor = theRawCluster->GetX(0);
87   fBendingCoor = theRawCluster->GetY(0);
88   // other fields will be updated in
89   // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
90   // except the following ones
91   fTHTrack = -1;
92   fGeantSignal = -1;
93   fIndexOfFirstSegment = -1;
94   fNSegments = 0;
95   fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
96   fNTrackHits = 0;
97   return;
98 }
99
100   //__________________________________________________________________________
101 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& rhs)
102   : TObject(rhs)
103 {
104 // Protected copy constructor
105
106   AliFatal( "Not implemented.");
107 }
108
109   //__________________________________________________________________________
110 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& rhs)
111 {
112 // Protected assignement operator
113
114   if (this == &rhs) return *this;
115
116   AliFatal( "Not implemented.");
117     
118   return *this;  
119 }
120   //__________________________________________________________________________
121 /*AZ
122 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
123 {
124   // "Compare" function to sort with increasing chamber number.
125   // Returns -1 (0, +1) if ChamberNumber of current HitForRec
126   // is smaller than (equal to, larger than) ChamberNumber of Hit
127   if (fChamberNumber <  ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
128   else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
129   else return(+1);
130 }
131 */
132   //__________________________________________________________________________
133 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
134 {
135   // "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
136   // Returns 1 (0, -1) if Z-coordinate of current HitForRec
137   // is smaller than (equal to, larger than) Z-coordinate of Hit
138   if (fZ <  ((AliMUONHitForRec*)Hit)->fZ) return(1);
139   else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
140   else return(-1);
141 }
142
143   //__________________________________________________________________________
144 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
145 {
146   // Calculate the normalized Chi2 between the current hitForRec (this)
147   // and the hitForRec pointed to by "hitForRec",
148   // i.e. the square deviations between the coordinates,
149   // 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,
152   // something smaller than or equal to 2 otherwise.
153   // Would it be more correct to use a real chi square
154   // including the non diagonal term ????
155   Double_t chi2, chi2Max, diff, normDiff;
156   chi2 = 0.0;
157   chi2Max = 3.0;
158   // coordinate in bending plane
159   diff = fBendingCoor - hitForRec->fBendingCoor;
160   normDiff = diff * diff /
161     (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
162   if (normDiff > 1.0) return chi2Max;
163   chi2 = chi2 + normDiff;
164   // coordinate in non bending plane
165   diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
166   normDiff = diff * diff /
167     (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
168   if (normDiff > 1.0) return chi2Max;
169   chi2 = chi2 + normDiff;
170   return chi2;
171 }