]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONHitForRec.cxx
Curent bur fixed
[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 /*
17 $Log$
18 Revision 1.5  2001/01/26 21:46:33  morsch
19 Use access functions to MUONHit, ... data members.
20
21 Revision 1.4  2000/10/02 21:28:09  fca
22 Removal of useless dependecies via forward declarations
23
24 Revision 1.3  2000/06/25 13:06:39  hristov
25 Inline functions moved from *.cxx to *.h files instead of forward declarations
26
27 Revision 1.2  2000/06/15 07:58:48  morsch
28 Code from MUON-dev joined
29
30 Revision 1.1.2.4  2000/06/12 10:11:10  morsch
31 Dummy copy constructor and assignment operator added
32
33 Revision 1.1.2.3  2000/06/09 22:14:43  morsch
34 Make includes consistent with new file naming.
35
36 Revision 1.1.2.2  2000/06/09 12:58:05  gosset
37 Removed comment beginnings in Log sections of .cxx files
38 Suppressed most violations of coding rules
39
40 Revision 1.1.2.1  2000/06/07 14:44:53  gosset
41 Addition of files for track reconstruction in C++
42 */
43
44 //__________________________________________________________________________
45 //
46 // Hit for reconstruction in ALICE dimuon spectrometer
47 //__________________________________________________________________________
48
49 #include "AliMUONHitForRec.h" 
50 #include "AliMUONTrackParam.h" 
51 #include "AliMUONRawCluster.h"
52 #include "AliMUONHit.h"
53
54 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
55
56   //__________________________________________________________________________
57 AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* Ghit)
58 {
59   // Constructor for AliMUONHitForRec from a GEANT hit.
60   // Fills the bending, non bending, and Z coordinates,
61   // which are taken from the coordinates of the GEANT hit,
62   // the track number (GEANT and not TH),
63   // and the chamber number (0...).
64   fBendingCoor = Ghit->Y();
65   fNonBendingCoor = Ghit->X();
66   fZ = Ghit->Z();
67   // fTrack = Ghit->fTrack; ?????????
68   fChamberNumber = Ghit->Chamber() - 1;
69   // other fields will be updated in
70   // AliMUONEventReconstructor::NewHitForRecFromGEANT,
71   // except the following ones
72   fIndexOfFirstSegment = -1;
73   fNSegments = 0;
74   fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
75   fNTrackHits = 0;
76   return;
77 }
78
79 //   //__________________________________________________________________________
80 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
81 // {
82 //   // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
83 //   // Fills the bending and non bending coordinates.
84 //   // Only the first correlation is taken into account.
85 //   // The bending coordinate is taken from the first cathode.
86 //   // The non bending coordinate is taken 
87 //   // from the second cathode if it exists,
88 //   // from the first one otherwise.
89 //   fBendingCoor = CathCorrel->fY[3];
90 //   if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
91 //   else fNonBendingCoor = CathCorrel->fX[3];
92 //   return;
93 // }
94
95   //__________________________________________________________________________
96 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* RawCluster)
97 {
98   // Constructor for AliMUONHitForRec from a raw cluster.
99   // Fills the bending and non bending coordinates.
100   fNonBendingCoor = RawCluster->fX[0];
101   fBendingCoor = RawCluster->fY[0];
102   // other fields will be updated in
103   // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
104   // except the following ones
105   fTHTrack = -1;
106   fGeantSignal = -1;
107   fIndexOfFirstSegment = -1;
108   fNSegments = 0;
109   fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
110   fNTrackHits = 0;
111   return;
112 }
113
114 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& MUONHitForRec)
115 {
116 // Dummy copy constructor
117 }
118
119 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& MUONHitForRec)
120 {
121 // Dummy assignment operator
122     return *this;
123 }
124   //__________________________________________________________________________
125 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
126 {
127   // "Compare" function to sort with increasing chamber number.
128   // Returns -1 (0, +1) if ChamberNumber of current HitForRec
129   // is smaller than (equal to, larger than) ChamberNumber of Hit
130   if (fChamberNumber <  ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
131   else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
132   else return(+1);
133 }
134
135   //__________________________________________________________________________
136 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* HitForRec, Double_t Sigma2Cut)
137 {
138   // Calculate the normalized Chi2 between the current HitForRec (this)
139   // and the HitForRec pointed to by "HitForRec",
140   // i.e. the square deviations between the coordinates,
141   // in both the bending and the non bending plane,
142   // divided by the variance of the same quantities and by "Sigma2Cut".
143   // Returns 3 if none of the 2 quantities is OK,
144   // something smaller than or equal to 2 otherwise.
145   // Would it be more correct to use a real chi square
146   // including the non diagonal term ????
147   Double_t chi2, chi2Max, diff, normDiff;
148   chi2 = 0.0;
149   chi2Max = 3.0;
150   // coordinate in bending plane
151   diff = this->fBendingCoor - HitForRec->fBendingCoor;
152   normDiff = diff * diff /
153     (this->fBendingReso2 + HitForRec->fBendingReso2) / Sigma2Cut;
154   if (normDiff > 1.0) return chi2Max;
155   chi2 = chi2 + normDiff;
156   // coordinate in non bending plane
157   diff = this->fNonBendingCoor - HitForRec->fNonBendingCoor;
158   normDiff = diff * diff /
159     (this->fNonBendingReso2 + HitForRec->fNonBendingReso2) / Sigma2Cut;
160   if (normDiff > 1.0) return chi2Max;
161   chi2 = chi2 + normDiff;
162   return chi2;
163 }