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