]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitForRec.cxx
- Class description on 5 lines (Coding conventions)
[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
88cb7938 16/* $Id$ */
a9e2aefa 17
d19b6003 18// ------------------------
19// Class AliMUONHitForRec
20// ------------------------
a9e2aefa 21// Hit for reconstruction in ALICE dimuon spectrometer
d19b6003 22// Author: J. Gosset
a9e2aefa 23
29fc2c86 24#include "AliTrackReference.h"
a9e2aefa 25#include "AliMUONHitForRec.h"
a9e2aefa 26#include "AliMUONRawCluster.h"
27#include "AliMUONHit.h"
29fc2c86 28#include "AliMUONConstants.h"
8c343c7c 29#include "AliLog.h"
a9e2aefa 30
31ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
32
33 //__________________________________________________________________________
30178c30 34AliMUONHitForRec::AliMUONHitForRec()
35 : TObject()
36{
d19b6003 37/// Default Constructor
30178c30 38
39 fFirstTrackHitPtr = 0;
40 fLastTrackHitPtr = 0;
41}
42
43 //__________________________________________________________________________
29fc2c86 44AliMUONHitForRec::AliMUONHitForRec(AliTrackReference* theGhit)
30178c30 45 : TObject()
a9e2aefa 46{
d19b6003 47/// Constructor for AliMUONHitForRec from a track ref. hit.
48/// Fills the bending, non bending, and Z coordinates,
49/// which are taken from the coordinates of the track ref. hit,
50/// the track number (track ref. and not TH),
51/// and the chamber number (0...).
52
30178c30 53 fBendingCoor = theGhit->Y();
54 fNonBendingCoor = theGhit->X();
55 fZ = theGhit->Z();
56 // fTrack = theGhit->fTrack; ?????????
29fc2c86 57 fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
38804330 58 fDetElemId = 0;
a9e2aefa 59 // other fields will be updated in
29fc2c86 60 // AliMUONEventReconstructor::NewHitForRecFromTrackRef,
a9e2aefa 61 // except the following ones
62 fIndexOfFirstSegment = -1;
63 fNSegments = 0;
64 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
65 fNTrackHits = 0;
66 return;
67}
68
69// //__________________________________________________________________________
70// AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
71// {
72// // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
73// // Fills the bending and non bending coordinates.
74// // Only the first correlation is taken into account.
75// // The bending coordinate is taken from the first cathode.
76// // The non bending coordinate is taken
77// // from the second cathode if it exists,
78// // from the first one otherwise.
79// fBendingCoor = CathCorrel->fY[3];
80// if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
81// else fNonBendingCoor = CathCorrel->fX[3];
82// return;
83// }
84
85 //__________________________________________________________________________
30178c30 86AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
87 : TObject()
a9e2aefa 88{
d19b6003 89/// Constructor for AliMUONHitForRec from a raw cluster.
90/// Fills the bending and non bending coordinates.
91
30178c30 92 fNonBendingCoor = theRawCluster->GetX(0);
93 fBendingCoor = theRawCluster->GetY(0);
7a773413 94 fDetElemId = theRawCluster->GetDetElemId();
a9e2aefa 95 // other fields will be updated in
96 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
97 // except the following ones
29fc2c86 98 fTTRTrack = -1;
99 fTrackRefSignal = -1;
a9e2aefa 100 fIndexOfFirstSegment = -1;
101 fNSegments = 0;
102 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
103 fNTrackHits = 0;
104 return;
105}
106
30178c30 107 //__________________________________________________________________________
b8dc484b 108AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
109 : TObject(theMUONHitForRec)
a9e2aefa 110{
d19b6003 111/// Copy constructor
112
b8dc484b 113 fBendingCoor = theMUONHitForRec.fBendingCoor;
114 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
115 fZ = theMUONHitForRec.fZ;
116 fBendingReso2 = theMUONHitForRec.fBendingReso2;
117 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
118 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 119 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 120 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 121 fTTRTrack = theMUONHitForRec.fTTRTrack;
122 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 123 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
124 fNSegments = theMUONHitForRec.fNSegments;
125 fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr;
126 fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr;
127 fNTrackHits = theMUONHitForRec.fNTrackHits;
a9e2aefa 128}
129
30178c30 130 //__________________________________________________________________________
b8dc484b 131AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
a9e2aefa 132{
d19b6003 133/// Assignment operator
134
b8dc484b 135 fBendingCoor = theMUONHitForRec.fBendingCoor;
136 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
137 fZ = theMUONHitForRec.fZ;
138 fBendingReso2 = theMUONHitForRec.fBendingReso2;
139 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
140 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 141 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 142 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 143 fTTRTrack = theMUONHitForRec.fTTRTrack;
144 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 145 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
146 fNSegments = theMUONHitForRec.fNSegments;
147 fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr;
148 fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr;
149 fNTrackHits = theMUONHitForRec.fNTrackHits;
b8dc484b 150 return *this;
a9e2aefa 151}
a9e2aefa 152 //__________________________________________________________________________
83dbc640 153/*AZ
2a941f4e 154Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
a9e2aefa 155{
156 // "Compare" function to sort with increasing chamber number.
157 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
158 // is smaller than (equal to, larger than) ChamberNumber of Hit
159 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
160 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
161 else return(+1);
162}
83dbc640 163*/
164 //__________________________________________________________________________
165Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
166{
d19b6003 167/// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
168/// Returns 1 (0, -1) if Z-coordinate of current HitForRec
169/// is smaller than (equal to, larger than) Z-coordinate of Hit
170
5b64e914 171 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
83dbc640 172 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
5b64e914 173 else return(-1);
83dbc640 174}
a9e2aefa 175
176 //__________________________________________________________________________
30178c30 177Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
a9e2aefa 178{
d19b6003 179/// Calculate the normalized Chi2 between the current hitForRec (this)
180/// and the hitForRec pointed to by "hitForRec",
181/// i.e. the square deviations between the coordinates,
182/// in both the bending and the non bending plane,
183/// divided by the variance of the same quantities and by "Sigma2Cut".
184/// Returns 3 if none of the 2 quantities is OK,
185/// something smaller than or equal to 2 otherwise.
186/// Would it be more correct to use a real chi square
187/// including the non diagonal term ????
188
a9e2aefa 189 Double_t chi2, chi2Max, diff, normDiff;
190 chi2 = 0.0;
191 chi2Max = 3.0;
192 // coordinate in bending plane
30178c30 193 diff = fBendingCoor - hitForRec->fBendingCoor;
a9e2aefa 194 normDiff = diff * diff /
30178c30 195 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
a9e2aefa 196 if (normDiff > 1.0) return chi2Max;
197 chi2 = chi2 + normDiff;
198 // coordinate in non bending plane
30178c30 199 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
a9e2aefa 200 normDiff = diff * diff /
30178c30 201 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
a9e2aefa 202 if (normDiff > 1.0) return chi2Max;
203 chi2 = chi2 + normDiff;
204 return chi2;
205}