1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
25 //-----------------------------------------------------------------
27 #include "AliESDCaloCluster.h"
29 ClassImp(AliESDCaloCluster)
31 //_______________________________________________________________________
32 AliESDCaloCluster::AliESDCaloCluster() :
35 fEMCALCluster(kFALSE),
45 fEmcCpvDistance(9999),
52 // The default ESD constructor
54 fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.;
55 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = 0.;
58 //_______________________________________________________________________
59 AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
62 fClusterType(clus.fClusterType),
63 fEMCALCluster(clus.fEMCALCluster),
64 fPHOSCluster(clus.fPHOSCluster),
65 fEnergy(clus.fEnergy),
66 fDispersion(clus.fDispersion),
68 fPrimaryIndex(clus.fPrimaryIndex),
72 fNExMax(clus.fNExMax),
73 fEmcCpvDistance(clus.fEmcCpvDistance),
74 fNumberOfDigits(clus.fNumberOfDigits),
80 // The copy constructor
82 fGlobalPos[0] = clus.fGlobalPos[0];
83 fGlobalPos[1] = clus.fGlobalPos[1];
84 fGlobalPos[2] = clus.fGlobalPos[2];
86 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i];
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];
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];
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];
107 //_______________________________________________________________________
108 AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
110 // assignment operator
112 if(&source == this) return *this;
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;
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;
132 fGlobalPos[0] = source.fGlobalPos[0];
133 fGlobalPos[1] = source.fGlobalPos[1];
134 fGlobalPos[2] = source.fGlobalPos[2];
136 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i];
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];
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];
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];
161 //_______________________________________________________________________
162 AliESDCaloCluster::~AliESDCaloCluster(){
164 // This is destructor according Coding Conventrions
166 // AliESDCaloCluster is the owner of the arrays
167 // even if they are created outside
169 delete[] fDigitAmplitude;
171 delete[] fDigitIndex;
175 //_______________________________________________________________________
176 void 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
182 // The negative weights are set to 0.
183 // In case all the weights are non-positive they are replaced by
184 // uniform probabilities
186 Int_t n = AliPID::kSPECIESN;
188 Float_t uniform = 1./(Float_t)n;
191 for (Int_t i=0; i<n; i++)
201 for (Int_t i=0; i<n; i++) fPID[i] /= sum;
203 for (Int_t i=0; i<n; i++) fPID[i] = uniform;