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