]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHitForRec.cxx
ReadRaw(): TGraphs are created once per event (B.Polichtchouk)
[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; ?????????
30d3ea8a 57 fDetElemId = theGhit->UserId();
58 if (fDetElemId) fChamberNumber = fDetElemId / 100 - 1;
59 else fChamberNumber = AliMUONConstants::ChamberNumber(fZ);
a9e2aefa 60 // other fields will be updated in
29fc2c86 61 // AliMUONEventReconstructor::NewHitForRecFromTrackRef,
a9e2aefa 62 // except the following ones
63 fIndexOfFirstSegment = -1;
64 fNSegments = 0;
65 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
66 fNTrackHits = 0;
67 return;
68}
69
70// //__________________________________________________________________________
71// AliMUONHitForRec::AliMUONHitForRec(AliMUONReconstHit* CathCorrel)
72// {
73// // Constructor for AliMUONHitForRec from a (cathode correlated) raw cluster.
74// // Fills the bending and non bending coordinates.
75// // Only the first correlation is taken into account.
76// // The bending coordinate is taken from the first cathode.
77// // The non bending coordinate is taken
78// // from the second cathode if it exists,
79// // from the first one otherwise.
80// fBendingCoor = CathCorrel->fY[3];
81// if (CathCorrel->fCorrelIndex[0] >= 0) fNonBendingCoor = CathCorrel->fX[0];
82// else fNonBendingCoor = CathCorrel->fX[3];
83// return;
84// }
85
86 //__________________________________________________________________________
30178c30 87AliMUONHitForRec::AliMUONHitForRec(AliMUONRawCluster* theRawCluster)
88 : TObject()
a9e2aefa 89{
d19b6003 90/// Constructor for AliMUONHitForRec from a raw cluster.
91/// Fills the bending and non bending coordinates.
92
30178c30 93 fNonBendingCoor = theRawCluster->GetX(0);
94 fBendingCoor = theRawCluster->GetY(0);
7a773413 95 fDetElemId = theRawCluster->GetDetElemId();
a9e2aefa 96 // other fields will be updated in
97 // AliMUONEventReconstructor::AddHitsForRecFromRawClusters,
98 // except the following ones
29fc2c86 99 fTTRTrack = -1;
100 fTrackRefSignal = -1;
a9e2aefa 101 fIndexOfFirstSegment = -1;
102 fNSegments = 0;
103 fFirstTrackHitPtr = fLastTrackHitPtr = NULL;
104 fNTrackHits = 0;
105 return;
106}
107
30178c30 108 //__________________________________________________________________________
b8dc484b 109AliMUONHitForRec::AliMUONHitForRec (const AliMUONHitForRec& theMUONHitForRec)
110 : TObject(theMUONHitForRec)
a9e2aefa 111{
d19b6003 112/// Copy constructor
113
b8dc484b 114 fBendingCoor = theMUONHitForRec.fBendingCoor;
115 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
116 fZ = theMUONHitForRec.fZ;
117 fBendingReso2 = theMUONHitForRec.fBendingReso2;
118 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
119 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 120 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 121 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 122 fTTRTrack = theMUONHitForRec.fTTRTrack;
123 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 124 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
125 fNSegments = theMUONHitForRec.fNSegments;
126 fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr;
127 fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr;
128 fNTrackHits = theMUONHitForRec.fNTrackHits;
a9e2aefa 129}
130
30178c30 131 //__________________________________________________________________________
b8dc484b 132AliMUONHitForRec & AliMUONHitForRec::operator=(const AliMUONHitForRec& theMUONHitForRec)
a9e2aefa 133{
d19b6003 134/// Assignment operator
135
b8dc484b 136 fBendingCoor = theMUONHitForRec.fBendingCoor;
137 fNonBendingCoor = theMUONHitForRec.fNonBendingCoor;
138 fZ = theMUONHitForRec.fZ;
139 fBendingReso2 = theMUONHitForRec.fBendingReso2;
140 fNonBendingReso2 = theMUONHitForRec.fNonBendingReso2;
141 fChamberNumber = theMUONHitForRec.fChamberNumber;
38804330 142 fDetElemId = theMUONHitForRec.fDetElemId;
b8dc484b 143 fHitNumber = theMUONHitForRec.fHitNumber;
29fc2c86 144 fTTRTrack = theMUONHitForRec.fTTRTrack;
145 fTrackRefSignal = theMUONHitForRec.fTrackRefSignal;
b8dc484b 146 fIndexOfFirstSegment = theMUONHitForRec.fIndexOfFirstSegment;
147 fNSegments = theMUONHitForRec.fNSegments;
148 fFirstTrackHitPtr = theMUONHitForRec.fFirstTrackHitPtr;
149 fLastTrackHitPtr = theMUONHitForRec.fLastTrackHitPtr;
150 fNTrackHits = theMUONHitForRec.fNTrackHits;
b8dc484b 151 return *this;
a9e2aefa 152}
a9e2aefa 153 //__________________________________________________________________________
83dbc640 154/*AZ
2a941f4e 155Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
a9e2aefa 156{
157 // "Compare" function to sort with increasing chamber number.
158 // Returns -1 (0, +1) if ChamberNumber of current HitForRec
159 // is smaller than (equal to, larger than) ChamberNumber of Hit
160 if (fChamberNumber < ((AliMUONHitForRec*)Hit)->fChamberNumber) return(-1);
161 else if (fChamberNumber == ((AliMUONHitForRec*)Hit)->fChamberNumber) return( 0);
162 else return(+1);
163}
83dbc640 164*/
165 //__________________________________________________________________________
166Int_t AliMUONHitForRec::Compare(const TObject* Hit) const
167{
d19b6003 168/// "Compare" function to sort with decreasing Z-coordinate (spectro. MUON z<0).
169/// Returns 1 (0, -1) if Z-coordinate of current HitForRec
170/// is smaller than (equal to, larger than) Z-coordinate of Hit
171
5b64e914 172 if (fZ < ((AliMUONHitForRec*)Hit)->fZ) return(1);
83dbc640 173 else if (fZ == ((AliMUONHitForRec*)Hit)->fZ) return( 0);
5b64e914 174 else return(-1);
83dbc640 175}
a9e2aefa 176
177 //__________________________________________________________________________
30178c30 178Double_t AliMUONHitForRec::NormalizedChi2WithHitForRec(AliMUONHitForRec* hitForRec, Double_t Sigma2Cut) const
a9e2aefa 179{
d19b6003 180/// Calculate the normalized Chi2 between the current hitForRec (this)
181/// and the hitForRec pointed to by "hitForRec",
182/// i.e. the square deviations between the coordinates,
183/// in both the bending and the non bending plane,
184/// divided by the variance of the same quantities and by "Sigma2Cut".
185/// Returns 3 if none of the 2 quantities is OK,
186/// something smaller than or equal to 2 otherwise.
187/// Would it be more correct to use a real chi square
188/// including the non diagonal term ????
189
a9e2aefa 190 Double_t chi2, chi2Max, diff, normDiff;
191 chi2 = 0.0;
192 chi2Max = 3.0;
193 // coordinate in bending plane
30178c30 194 diff = fBendingCoor - hitForRec->fBendingCoor;
a9e2aefa 195 normDiff = diff * diff /
30178c30 196 (fBendingReso2 + hitForRec->fBendingReso2) / Sigma2Cut;
a9e2aefa 197 if (normDiff > 1.0) return chi2Max;
198 chi2 = chi2 + normDiff;
199 // coordinate in non bending plane
30178c30 200 diff = fNonBendingCoor - hitForRec->fNonBendingCoor;
a9e2aefa 201 normDiff = diff * diff /
30178c30 202 (fNonBendingReso2 + hitForRec->fNonBendingReso2) / Sigma2Cut;
a9e2aefa 203 if (normDiff > 1.0) return chi2Max;
204 chi2 = chi2 + normDiff;
205 return chi2;
206}