]>
Commit | Line | Data |
---|---|---|
85c60a8e | 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 | ||
16 | /* $Id$ */ | |
17 | /* $Log $ */ | |
18 | ||
19 | //----------------------------------------------------------------- | |
20 | // Implementation of the ESD Calorimeter cluster class | |
21 | // ESD = Event Summary Data | |
22 | // This is the class to deal with during the phisics analysis of data | |
23 | // | |
24 | // J.L. Klay (LLNL) | |
25 | //----------------------------------------------------------------- | |
26 | ||
bab0b5f0 | 27 | #include <TLorentzVector.h> |
85c60a8e | 28 | #include "AliESDCaloCluster.h" |
29 | ||
30 | ClassImp(AliESDCaloCluster) | |
31 | ||
32 | //_______________________________________________________________________ | |
33 | AliESDCaloCluster::AliESDCaloCluster() : | |
34 | fID(0), | |
35 | fClusterType(-1), | |
36 | fEMCALCluster(kFALSE), | |
fe12e09c | 37 | fPHOSCluster(kFALSE), |
85c60a8e | 38 | fEnergy(-1), |
39 | fDispersion(-1), | |
40 | fChi2(-1), | |
e3e93796 | 41 | fM20(0), |
42 | fM02(0), | |
43 | fM11(0), | |
44 | fNExMax(0), | |
45 | fEmcCpvDistance(9999), | |
45636e1b | 46 | fDistToBadChannel(9999), |
5efdec54 | 47 | fTracksMatched(0x0), |
48 | fLabels(0x0), | |
fe12e09c | 49 | fDigitAmplitude(0x0), |
50 | fDigitTime(0x0), | |
51 | fDigitIndex(0x0) | |
85c60a8e | 52 | { |
53 | // | |
54 | // The default ESD constructor | |
55 | // | |
56 | fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.; | |
57 | for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = 0.; | |
58 | } | |
59 | ||
60 | //_______________________________________________________________________ | |
61 | AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) : | |
62 | TObject(clus), | |
63 | fID(clus.fID), | |
64 | fClusterType(clus.fClusterType), | |
65 | fEMCALCluster(clus.fEMCALCluster), | |
fe12e09c | 66 | fPHOSCluster(clus.fPHOSCluster), |
85c60a8e | 67 | fEnergy(clus.fEnergy), |
68 | fDispersion(clus.fDispersion), | |
69 | fChi2(clus.fChi2), | |
e3e93796 | 70 | fM20(clus.fM20), |
71 | fM02(clus.fM02), | |
e0af7ed2 | 72 | fM11(clus.fM11), |
e3e93796 | 73 | fNExMax(clus.fNExMax), |
74 | fEmcCpvDistance(clus.fEmcCpvDistance), | |
45636e1b | 75 | fDistToBadChannel(clus.fDistToBadChannel), |
a934c866 | 76 | fTracksMatched(clus.fTracksMatched?new TArrayS(*clus.fTracksMatched):0x0), |
77 | fLabels(clus.fLabels?new TArrayS(*clus.fLabels):0x0), | |
78 | fDigitAmplitude(clus.fDigitAmplitude?new TArrayS(*clus.fDigitAmplitude):0x0), | |
79 | fDigitTime(clus.fDigitTime?new TArrayS(*clus.fDigitTime):0x0), | |
80 | fDigitIndex(clus.fDigitIndex?new TArrayS(*clus.fDigitIndex):0x0) | |
85c60a8e | 81 | { |
82 | // | |
83 | // The copy constructor | |
84 | // | |
85 | fGlobalPos[0] = clus.fGlobalPos[0]; | |
86 | fGlobalPos[1] = clus.fGlobalPos[1]; | |
87 | fGlobalPos[2] = clus.fGlobalPos[2]; | |
88 | ||
89 | for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i]; | |
90 | ||
85c60a8e | 91 | } |
92 | ||
fe12e09c | 93 | //_______________________________________________________________________ |
94 | AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source) | |
95 | { | |
96 | // assignment operator | |
97 | ||
98 | if(&source == this) return *this; | |
99 | ||
100 | fID = source.fID; | |
101 | fClusterType = source.fClusterType; | |
102 | fEMCALCluster = source.fEMCALCluster; | |
103 | fPHOSCluster = source.fPHOSCluster; | |
104 | fEnergy = source.fEnergy; | |
105 | fDispersion = source.fDispersion; | |
106 | fChi2 = source.fChi2; | |
fe12e09c | 107 | fM20 = source.fM20; |
108 | fM02 = source.fM02; | |
109 | fM11 = source.fM11; | |
110 | fNExMax = source.fNExMax; | |
111 | fEmcCpvDistance = source.fEmcCpvDistance; | |
45636e1b | 112 | fDistToBadChannel = source.fDistToBadChannel ; |
fe12e09c | 113 | |
114 | fGlobalPos[0] = source.fGlobalPos[0]; | |
115 | fGlobalPos[1] = source.fGlobalPos[1]; | |
116 | fGlobalPos[2] = source.fGlobalPos[2]; | |
117 | ||
118 | for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i]; | |
119 | ||
a934c866 | 120 | fTracksMatched = source.fTracksMatched?new TArrayS(*source.fTracksMatched):0x0; |
121 | fLabels = source.fLabels?new TArrayS(*source.fLabels):0x0; | |
122 | fDigitAmplitude = source.fDigitAmplitude?new TArrayS(*source.fDigitAmplitude):0x0; | |
123 | fDigitTime = source.fDigitTime?new TArrayS(*source.fDigitTime):0x0; | |
124 | fDigitIndex = source.fDigitIndex?new TArrayS(*source.fDigitIndex):0x0; | |
fe12e09c | 125 | |
126 | return *this; | |
127 | ||
128 | } | |
129 | ||
85c60a8e | 130 | |
131 | //_______________________________________________________________________ | |
132 | AliESDCaloCluster::~AliESDCaloCluster(){ | |
133 | // | |
5efdec54 | 134 | // This is destructor according Coding Conventions |
85c60a8e | 135 | // |
5efdec54 | 136 | delete fTracksMatched; |
137 | delete fLabels; | |
138 | delete fDigitAmplitude; | |
139 | delete fDigitTime; | |
140 | delete fDigitIndex; | |
e0af7ed2 | 141 | |
85c60a8e | 142 | } |
143 | ||
144 | //_______________________________________________________________________ | |
145 | void AliESDCaloCluster::SetPid(const Float_t *p) { | |
146 | // Sets the probability of each particle type | |
147 | // Copied from AliESDtrack SetPIDValues | |
148 | // This function copies "n" PID weights from "scr" to "dest" | |
149 | // and normalizes their sum to 1 thus producing conditional | |
150 | // probabilities. | |
151 | // The negative weights are set to 0. | |
152 | // In case all the weights are non-positive they are replaced by | |
153 | // uniform probabilities | |
154 | ||
155 | Int_t n = AliPID::kSPECIESN; | |
156 | ||
157 | Float_t uniform = 1./(Float_t)n; | |
158 | ||
159 | Float_t sum = 0; | |
160 | for (Int_t i=0; i<n; i++) | |
161 | if (p[i]>=0) { | |
162 | sum+=p[i]; | |
163 | fPID[i] = p[i]; | |
164 | } | |
165 | else { | |
166 | fPID[i] = 0; | |
167 | } | |
168 | ||
169 | if(sum>0) | |
170 | for (Int_t i=0; i<n; i++) fPID[i] /= sum; | |
171 | else | |
172 | for (Int_t i=0; i<n; i++) fPID[i] = uniform; | |
173 | ||
174 | } | |
bab0b5f0 | 175 | |
176 | //_______________________________________________________________________ | |
5efdec54 | 177 | void AliESDCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) { |
bab0b5f0 | 178 | // Returns TLorentzVector with momentum of the cluster. Only valid for clusters |
179 | // identified as photons or pi0 (overlapped gamma) produced on the vertex | |
5efdec54 | 180 | //Vertex can be recovered with esd pointer doing: |
181 | //" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; " | |
182 | ||
183 | if(vertex){//calculate direction from vertex | |
184 | fGlobalPos[0]-=vertex[0]; | |
185 | fGlobalPos[1]-=vertex[1]; | |
186 | fGlobalPos[2]-=vertex[2]; | |
187 | } | |
bab0b5f0 | 188 | |
189 | Double_t r = TMath::Sqrt(fGlobalPos[0]*fGlobalPos[0]+ | |
190 | fGlobalPos[1]*fGlobalPos[1]+ | |
191 | fGlobalPos[2]*fGlobalPos[2] ) ; | |
192 | ||
193 | p.SetPxPyPzE( fEnergy*fGlobalPos[0]/r, fEnergy*fGlobalPos[1]/r, fEnergy*fGlobalPos[2]/r, fEnergy) ; | |
194 | ||
195 | } |