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