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