]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDCaloCluster.cxx
Removing semaphore .done files.
[u/mrichter/AliRoot.git] / STEER / AliESDCaloCluster.cxx
CommitLineData
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
27#include "AliESDCaloCluster.h"
28
29ClassImp(AliESDCaloCluster)
30
31//_______________________________________________________________________
32AliESDCaloCluster::AliESDCaloCluster() :
33 fID(0),
34 fClusterType(-1),
35 fEMCALCluster(kFALSE),
fe12e09c 36 fPHOSCluster(kFALSE),
85c60a8e 37 fEnergy(-1),
38 fDispersion(-1),
39 fChi2(-1),
e3e93796 40 fPrimaryIndex(-1),
41 fM20(0),
42 fM02(0),
43 fM11(0),
44 fNExMax(0),
45 fEmcCpvDistance(9999),
85c60a8e 46 fNumberOfDigits(0),
fe12e09c 47 fDigitAmplitude(0x0),
48 fDigitTime(0x0),
49 fDigitIndex(0x0)
85c60a8e 50{
51 //
52 // The default ESD constructor
53 //
54 fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.;
55 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = 0.;
56}
57
58//_______________________________________________________________________
59AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
60 TObject(clus),
61 fID(clus.fID),
62 fClusterType(clus.fClusterType),
63 fEMCALCluster(clus.fEMCALCluster),
fe12e09c 64 fPHOSCluster(clus.fPHOSCluster),
85c60a8e 65 fEnergy(clus.fEnergy),
66 fDispersion(clus.fDispersion),
67 fChi2(clus.fChi2),
e3e93796 68 fPrimaryIndex(clus.fPrimaryIndex),
69 fM20(clus.fM20),
70 fM02(clus.fM02),
e0af7ed2 71 fM11(clus.fM11),
e3e93796 72 fNExMax(clus.fNExMax),
73 fEmcCpvDistance(clus.fEmcCpvDistance),
fe12e09c 74 fNumberOfDigits(clus.fNumberOfDigits),
75 fDigitAmplitude(0x0),
76 fDigitTime(0x0),
77 fDigitIndex(0x0)
85c60a8e 78{
79 //
80 // The copy constructor
81 //
82 fGlobalPos[0] = clus.fGlobalPos[0];
83 fGlobalPos[1] = clus.fGlobalPos[1];
84 fGlobalPos[2] = clus.fGlobalPos[2];
85
86 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i];
87
e0af7ed2 88 if (clus.fNumberOfDigits > 0) {
89 if (clus.fDigitAmplitude) {
90 fDigitAmplitude = new UShort_t[clus.fNumberOfDigits];
91 for (Int_t i=0; i<clus.fNumberOfDigits; i++)
92 fDigitAmplitude[i]=clus.fDigitAmplitude[i];
93 }
94 if (clus.fDigitTime) {
95 fDigitTime = new UShort_t[clus.fNumberOfDigits];
96 for (Int_t i=0; i<clus.fNumberOfDigits; i++)
97 fDigitTime[i]=clus.fDigitTime[i];
98 }
99 if (clus.fDigitIndex) {
100 fDigitIndex = new UShort_t[clus.fNumberOfDigits];
101 for (Int_t i=0; i<clus.fNumberOfDigits; i++)
102 fDigitIndex[i]=clus.fDigitIndex[i];
103 }
104 }
85c60a8e 105}
106
fe12e09c 107//_______________________________________________________________________
108AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
109{
110 // assignment operator
111
112 if(&source == this) return *this;
113
114 fID = source.fID;
115 fClusterType = source.fClusterType;
116 fEMCALCluster = source.fEMCALCluster;
117 fPHOSCluster = source.fPHOSCluster;
118 fEnergy = source.fEnergy;
119 fDispersion = source.fDispersion;
120 fChi2 = source.fChi2;
121 fPrimaryIndex = source.fPrimaryIndex;
122 fM20 = source.fM20;
123 fM02 = source.fM02;
124 fM11 = source.fM11;
125 fNExMax = source.fNExMax;
126 fEmcCpvDistance = source.fEmcCpvDistance;
127 fNumberOfDigits = source.fNumberOfDigits;
128 delete fDigitAmplitude; fDigitAmplitude=0x0;
129 delete fDigitTime; fDigitTime = 0x0;
130 delete fDigitIndex; fDigitIndex = 0x0;
131
132 fGlobalPos[0] = source.fGlobalPos[0];
133 fGlobalPos[1] = source.fGlobalPos[1];
134 fGlobalPos[2] = source.fGlobalPos[2];
135
136 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i];
137
138 if (source.fNumberOfDigits > 0) {
139 if (source.fDigitAmplitude) {
140 fDigitAmplitude = new UShort_t[source.fNumberOfDigits];
141 for (Int_t i=0; i<source.fNumberOfDigits; i++)
142 fDigitAmplitude[i]=source.fDigitAmplitude[i];
143 }
144 if (source.fDigitTime) {
145 fDigitTime = new UShort_t[source.fNumberOfDigits];
146 for (Int_t i=0; i<source.fNumberOfDigits; i++)
147 fDigitTime[i]=source.fDigitTime[i];
148 }
149 if (source.fDigitIndex) {
150 fDigitIndex = new UShort_t[source.fNumberOfDigits];
151 for (Int_t i=0; i<source.fNumberOfDigits; i++)
152 fDigitIndex[i]=source.fDigitIndex[i];
153 }
154 }
155
156 return *this;
157
158}
159
85c60a8e 160
161//_______________________________________________________________________
162AliESDCaloCluster::~AliESDCaloCluster(){
163 //
164 // This is destructor according Coding Conventrions
165 //
e0af7ed2 166 // AliESDCaloCluster is the owner of the arrays
167 // even if they are created outside
168
169 delete[] fDigitAmplitude;
170 delete[] fDigitTime;
171 delete[] fDigitIndex;
172
85c60a8e 173}
174
175//_______________________________________________________________________
176void AliESDCaloCluster::SetPid(const Float_t *p) {
177 // Sets the probability of each particle type
178 // Copied from AliESDtrack SetPIDValues
179 // This function copies "n" PID weights from "scr" to "dest"
180 // and normalizes their sum to 1 thus producing conditional
181 // probabilities.
182 // The negative weights are set to 0.
183 // In case all the weights are non-positive they are replaced by
184 // uniform probabilities
185
186 Int_t n = AliPID::kSPECIESN;
187
188 Float_t uniform = 1./(Float_t)n;
189
190 Float_t sum = 0;
191 for (Int_t i=0; i<n; i++)
192 if (p[i]>=0) {
193 sum+=p[i];
194 fPID[i] = p[i];
195 }
196 else {
197 fPID[i] = 0;
198 }
199
200 if(sum>0)
201 for (Int_t i=0; i<n; i++) fPID[i] /= sum;
202 else
203 for (Int_t i=0; i<n; i++) fPID[i] = uniform;
204
205}