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 //__________________________________________________________________________
20 // Hit for reconstruction in ALICE dimuon spectrometer
21 //__________________________________________________________________________
23 #include "AliMUONHitForRec.h"
24 #include "AliMUONRawCluster.h"
25 #include "AliMUONHit.h"
27 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
29 //__________________________________________________________________________
30 AliMUONHitForRec::AliMUONHitForRec()
33 // Default Constructor
35 fFirstTrackHitPtr = 0;
39 //__________________________________________________________________________
40 AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* theGhit)
43 // Constructor for AliMUONHitForRec from a GEANT hit.
44 // Fills the bending, non bending, and Z coordinates,
45 // which are taken from the coordinates of the GEANT hit,
46 // the track number (GEANT and not TH),
47 // and the chamber number (0...).
48 fBendingCoor = theGhit->Y();
49 fNonBendingCoor = theGhit->X();
51 // fTrack = theGhit->fTrack; ?????????
52 fChamberNumber = theGhit->Chamber() - 1;
53 // other fields will be updated in
54 // AliMUONEventReconstructor::NewHitForRecFromGEANT,
55 // except the following ones
56 fIndexOfFirstSegment = -1;
58 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
63 // //__________________________________________________________________________
64 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
66 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
67 // // Fills the bending and non bending coordinates.
68 // // Only the first correlation is taken into account.
69 // // The bending coordinate is taken from the first cathode.
70 // // The non bending coordinate is taken
71 // // from the second cathode if it exists,
72 // // from the first one otherwise.
73 // fBendingCoor = CathCorrel->fY[3];
74 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
75 // else fNonBendingCoor = CathCorrel->fX[3];
79 //__________________________________________________________________________
80 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
83 // Constructor for AliMUONHitForRec from a raw cluster.
84 // Fills the bending and non bending coordinates.
85 fNonBendingCoor = theRawCluster->GetX(0);
86 fBendingCoor = theRawCluster->GetY(0);
87 // other fields will be updated in
88 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
89 // except the following ones
92 fIndexOfFirstSegment = -1;
94 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
99 //__________________________________________________________________________
100 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& rhs)
103 // Protected copy constructor
105 Fatal("AliMUONHitForRec", "Not implemented.");
108 //__________________________________________________________________________
109 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& rhs)
111 // Protected assignement operator
113 if (this == &rhs) return *this;
115 Fatal("operator=", "Not implemented.");
119 //__________________________________________________________________________
121 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
123 // "Compare" function to sort with increasing chamber number.
124 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
125 // is smaller than (equal to, larger than) ChamberNumber of Hit
126 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
127 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
131 //__________________________________________________________________________
132 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
134 // "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
135 // Returns 1 (0, -1) if Z-coordinate of current HitForRec
136 // is smaller than (equal to, larger than) Z-coordinate of Hit
137 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
138 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
142 //__________________________________________________________________________
143 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
145 // Calculate the normalized Chi2 between the current hitForRec (this)
146 // and the hitForRec pointed to by "hitForRec",
147 // i.e. the square deviations between the coordinates,
148 // in both the bending and the non bending plane,
149 // divided by the variance of the same quantities and by "Sigma2Cut".
150 // Returns 3 if none of the 2 quantities is OK,
151 // something smaller than or equal to 2 otherwise.
152 // Would it be more correct to use a real chi square
153 // including the non diagonal term ????
154 Double_t chi2, chi2Max, diff, normDiff;
157 // coordinate in bending plane
158 diff = fBendingCoor - hitForRec->fBendingCoor;
159 normDiff = diff * diff /
160 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
161 if (normDiff > 1.0) return chi2Max;
162 chi2 = chi2 + normDiff;
163 // coordinate in non bending plane
164 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
165 normDiff = diff * diff /
166 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
167 if (normDiff > 1.0) return chi2Max;
168 chi2 = chi2 + normDiff;