1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.6 2001/02/05 14:49:29 hristov
19 Compare() declared const (R.Brun)
21 Revision 1.5 2001/01/26 21:46:33 morsch
22 Use access functions to MUONHit, ... data members.
24 Revision 1.4 2000/10/02 21:28:09 fca
25 Removal of useless dependecies via forward declarations
27 Revision 1.3 2000/06/25 13:06:39 hristov
28 Inline functions moved from *.cxx to *.h files instead of forward declarations
30 Revision 1.2 2000/06/15 07:58:48 morsch
31 Code from MUON-dev joined
33 Revision 1.1.2.4 2000/06/12 10:11:10 morsch
34 Dummy copy constructor and assignment operator added
36 Revision 1.1.2.3 2000/06/09 22:14:43 morsch
37 Make includes consistent with new file naming.
39 Revision 1.1.2.2 2000/06/09 12:58:05 gosset
40 Removed comment beginnings in Log sections of .cxx files
41 Suppressed most violations of coding rules
43 Revision 1.1.2.1 2000/06/07 14:44:53 gosset
44 Addition of files for track reconstruction in C++
47 //__________________________________________________________________________
49 // Hit for reconstruction in ALICE dimuon spectrometer
50 //__________________________________________________________________________
52 #include "AliMUONHitForRec.h"
53 #include "AliMUONTrackParam.h"
54 #include "AliMUONRawCluster.h"
55 #include "AliMUONHit.h"
57 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
59 //__________________________________________________________________________
60 AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* Ghit)
62 // Constructor for AliMUONHitForRec from a GEANT hit.
63 // Fills the bending, non bending, and Z coordinates,
64 // which are taken from the coordinates of the GEANT hit,
65 // the track number (GEANT and not TH),
66 // and the chamber number (0...).
67 fBendingCoor = Ghit->Y();
68 fNonBendingCoor = Ghit->X();
70 // fTrack = Ghit->fTrack; ?????????
71 fChamberNumber = Ghit->Chamber() - 1;
72 // other fields will be updated in
73 // AliMUONEventReconstructor::NewHitForRecFromGEANT,
74 // except the following ones
75 fIndexOfFirstSegment = -1;
77 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
82 // //__________________________________________________________________________
83 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
85 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
86 // // Fills the bending and non bending coordinates.
87 // // Only the first correlation is taken into account.
88 // // The bending coordinate is taken from the first cathode.
89 // // The non bending coordinate is taken
90 // // from the second cathode if it exists,
91 // // from the first one otherwise.
92 // fBendingCoor = CathCorrel->fY[3];
93 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
94 // else fNonBendingCoor = CathCorrel->fX[3];
98 //__________________________________________________________________________
99 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* RawCluster)
101 // Constructor for AliMUONHitForRec from a raw cluster.
102 // Fills the bending and non bending coordinates.
103 fNonBendingCoor = RawCluster->fX[0];
104 fBendingCoor = RawCluster->fY[0];
105 // other fields will be updated in
106 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
107 // except the following ones
110 fIndexOfFirstSegment = -1;
112 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
117 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& MUONHitForRec)
119 // Dummy copy constructor
122 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& MUONHitForRec)
124 // Dummy assignment operator
127 //__________________________________________________________________________
129 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
131 // "Compare" function to sort with increasing chamber number.
132 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
133 // is smaller than (equal to, larger than) ChamberNumber of Hit
134 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
135 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
139 //__________________________________________________________________________
140 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
142 // "Compare" function to sort with increasing Z-coordinate.
143 // Returns -1 (0, +1) if Z-coordinate of current HitForRec
144 // is smaller than (equal to, larger than) Z-coordinate of Hit
145 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(-1);
146 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
150 //__________________________________________________________________________
151 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* HitForRec, Double_t Sigma2Cut)
153 // Calculate the normalized Chi2 between the current HitForRec (this)
154 // and the HitForRec pointed to by "HitForRec",
155 // i.e. the square deviations between the coordinates,
156 // in both the bending and the non bending plane,
157 // divided by the variance of the same quantities and by "Sigma2Cut".
158 // Returns 3 if none of the 2 quantities is OK,
159 // something smaller than or equal to 2 otherwise.
160 // Would it be more correct to use a real chi square
161 // including the non diagonal term ????
162 Double_t chi2, chi2Max, diff, normDiff;
165 // coordinate in bending plane
166 diff = this->fBendingCoor - HitForRec->fBendingCoor;
167 normDiff = diff * diff /
168 (this->fBendingReso2 + HitForRec->fBendingReso2) / Sigma2Cut;
169 if (normDiff > 1.0) return chi2Max;
170 chi2 = chi2 + normDiff;
171 // coordinate in non bending plane
172 diff = this->fNonBendingCoor - HitForRec->fNonBendingCoor;
173 normDiff = diff * diff /
174 (this->fNonBendingReso2 + HitForRec->fNonBendingReso2) / Sigma2Cut;
175 if (normDiff > 1.0) return chi2Max;
176 chi2 = chi2 + normDiff;