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"
28 ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
30 //__________________________________________________________________________
31 AliMUONHitForRec::AliMUONHitForRec()
34 // Default Constructor
36 fFirstTrackHitPtr = 0;
40 //__________________________________________________________________________
41 AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* theGhit)
44 // Constructor for AliMUONHitForRec from a GEANT hit.
45 // Fills the bending, non bending, and Z coordinates,
46 // which are taken from the coordinates of the GEANT hit,
47 // the track number (GEANT and not TH),
48 // and the chamber number (0...).
49 fBendingCoor = theGhit->Y();
50 fNonBendingCoor = theGhit->X();
52 // fTrack = theGhit->fTrack; ?????????
53 fChamberNumber = theGhit->Chamber() - 1;
54 // other fields will be updated in
55 // AliMUONEventReconstructor::NewHitForRecFromGEANT,
56 // except the following ones
57 fIndexOfFirstSegment = -1;
59 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
64 // //__________________________________________________________________________
65 // AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
67 // // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
68 // // Fills the bending and non bending coordinates.
69 // // Only the first correlation is taken into account.
70 // // The bending coordinate is taken from the first cathode.
71 // // The non bending coordinate is taken
72 // // from the second cathode if it exists,
73 // // from the first one otherwise.
74 // fBendingCoor = CathCorrel->fY[3];
75 // if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
76 // else fNonBendingCoor = CathCorrel->fX[3];
80 //__________________________________________________________________________
81 AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
84 // Constructor for AliMUONHitForRec from a raw cluster.
85 // Fills the bending and non bending coordinates.
86 fNonBendingCoor = theRawCluster->GetX(0);
87 fBendingCoor = theRawCluster->GetY(0);
88 // other fields will be updated in
89 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
90 // except the following ones
93 fIndexOfFirstSegment = -1;
95 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
100 //__________________________________________________________________________
101 AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& rhs)
104 // Protected copy constructor
106 AliFatal( "Not implemented.");
109 //__________________________________________________________________________
110 AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& rhs)
112 // Protected assignement operator
114 if (this == &rhs) return *this;
116 AliFatal( "Not implemented.");
120 //__________________________________________________________________________
122 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
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);
132 //__________________________________________________________________________
133 Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
135 // "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
136 // Returns 1 (0, -1) if Z-coordinate of current HitForRec
137 // is smaller than (equal to, larger than) Z-coordinate of Hit
138 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
139 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
143 //__________________________________________________________________________
144 Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
146 // Calculate the normalized Chi2 between the current hitForRec (this)
147 // and the hitForRec pointed to by "hitForRec",
148 // i.e. the square deviations between the coordinates,
149 // in both the bending and the non bending plane,
150 // divided by the variance of the same quantities and by "Sigma2Cut".
151 // Returns 3 if none of the 2 quantities is OK,
152 // something smaller than or equal to 2 otherwise.
153 // Would it be more correct to use a real chi square
154 // including the non diagonal term ????
155 Double_t chi2, chi2Max, diff, normDiff;
158 // coordinate in bending plane
159 diff = fBendingCoor - hitForRec->fBendingCoor;
160 normDiff = diff * diff /
161 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
162 if (normDiff > 1.0) return chi2Max;
163 chi2 = chi2 + normDiff;
164 // coordinate in non bending plane
165 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
166 normDiff = diff * diff /
167 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
168 if (normDiff > 1.0) return chi2Max;
169 chi2 = chi2 + normDiff;