]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitForRec.cxx
Logging of Debug, Info and Error Messages follwing AliRoot Standard http://aliweb...
[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
18//__________________________________________________________________________
19//
20// Hit for reconstruction in ALICE dimuon spectrometer
21//__________________________________________________________________________
22
23#include "AliMUONHitForRec.h"
a9e2aefa 24#include "AliMUONRawCluster.h"
25#include "AliMUONHit.h"
d12a7158 26#include "AliLog.h"
a9e2aefa 27
28ClassImp(AliMUONHitForRec) // Class implementation in ROOT context
29
30 //__________________________________________________________________________
30178c30 31AliMUONHitForRec::AliMUONHitForRec()
32 : TObject()
33{
34 // Default Constructor
35
36 fFirstTrackHitPtr = 0;
37 fLastTrackHitPtr = 0;
38}
39
40 //__________________________________________________________________________
41AliMUONHitForRec::AliMUONHitForRec(AliMUONHit* theGhit)
42 : TObject()
a9e2aefa 43{
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...).
30178c30 49 fBendingCoor = theGhit->Y();
50 fNonBendingCoor = theGhit->X();
51 fZ = theGhit->Z();
52 // fTrack = theGhit->fTrack; ?????????
53 fChamberNumber = theGhit->Chamber() - 1;
a9e2aefa 54 // other fields will be updated in
55 // AliMUONEventReconstructor::NewHitForRecFromGEANT,
56 // except the following ones
57 fIndexOfFirstSegment = -1;
58 fNSegments = 0;
59 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
60 fNTrackHits = 0;
61 return;
62}
63
64// //__________________________________________________________________________
65// AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
66// {
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];
77// return;
78// }
79
80 //__________________________________________________________________________
30178c30 81AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
82 : TObject()
a9e2aefa 83{
84 // Constructor for AliMUONHitForRec from a raw cluster.
85 // Fills the bending and non bending coordinates.
30178c30 86 fNonBendingCoor = theRawCluster->GetX(0);
87 fBendingCoor = theRawCluster->GetY(0);
a9e2aefa 88 // other fields will be updated in
89 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
90 // except the following ones
91 fTHTrack = -1;
92 fGeantSignal = -1;
93 fIndexOfFirstSegment = -1;
94 fNSegments = 0;
95 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
96 fNTrackHits = 0;
97 return;
98}
99
30178c30 100 //__________________________________________________________________________
101AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& rhs)
102 : TObject(rhs)
a9e2aefa 103{
30178c30 104// Protected copy constructor
105
d12a7158 106 AliFatal( "Not implemented.");
a9e2aefa 107}
108
30178c30 109 //__________________________________________________________________________
110AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& rhs)
a9e2aefa 111{
30178c30 112// Protected assignement operator
113
114 if (this == &rhs) return *this;
115
d12a7158 116 AliFatal( "Not implemented.");
30178c30 117
118 return *this;
a9e2aefa 119}
a9e2aefa 120 //__________________________________________________________________________
83dbc640 121/*AZ
2a941f4e 122Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
a9e2aefa 123{
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);
129 else return(+1);
130}
83dbc640 131*/
132 //__________________________________________________________________________
133Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
134{
5b64e914 135 // "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
136 // Returns 1 (0, -1) if Z-coordinate of current HitForRec
83dbc640 137 // is smaller than (equal to, larger than) Z-coordinate of Hit
5b64e914 138 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
83dbc640 139 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
5b64e914 140 else return(-1);
83dbc640 141}
a9e2aefa 142
143 //__________________________________________________________________________
30178c30 144Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
a9e2aefa 145{
30178c30 146 // Calculate the normalized Chi2 between the current hitForRec (this)
147 // and the hitForRec pointed to by "hitForRec",
a9e2aefa 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;
156 chi2 = 0.0;
157 chi2Max = 3.0;
158 // coordinate in bending plane
30178c30 159 diff = fBendingCoor - hitForRec->fBendingCoor;
a9e2aefa 160 normDiff = diff * diff /
30178c30 161 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
a9e2aefa 162 if (normDiff > 1.0) return chi2Max;
163 chi2 = chi2 + normDiff;
164 // coordinate in non bending plane
30178c30 165 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
a9e2aefa 166 normDiff = diff * diff /
30178c30 167 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
a9e2aefa 168 if (normDiff > 1.0) return chi2Max;
169 chi2 = chi2 + normDiff;
170 return chi2;
171}