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.2 2000/06/15 07:58:48 morsch
19 Code from MUON-dev joined
21 Revision 1.1.2.4 2000/06/12 10:11:10 morsch
22 Dummy copy constructor and assignment operator added
24 Revision 1.1.2.3 2000/06/09 22:14:43 morsch
25 Make includes consistent with new file naming.
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
31 Revision 1.1.2.1 2000/06/07 14:44:53 gosset
32 Addition of files for track reconstruction in C++
35 //__________________________________________________________________________
37 // Hit for reconstruction in ALICE dimuon spectrometer
38 //__________________________________________________________________________
40 #include "AliMUONHitForRec.h"
41 #include "AliMUONTrackParam.h"
42 #include "AliMUONRawCluster.h"
43 #include "AliMUONHit.h"
45 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
47 //__________________________________________________________________________
48 AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* Ghit)
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;
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;
65 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
70 // //__________________________________________________________________________
71 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
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];
86 //__________________________________________________________________________
87 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* RawCluster)
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
98 fIndexOfFirstSegment = -1;
100 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
105 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& MUONHitForRec)
107 // Dummy copy constructor
110 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& MUONHitForRec)
112 // Dummy assignment operator
115 //__________________________________________________________________________
116 Int_t AliMUONHitForRec::Compare(TObject* Hit)
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);
126 //__________________________________________________________________________
127 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* HitForRec, Double_t Sigma2Cut)
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;
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;