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