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),
44 fEmcCpvDistance(9999),
51 // The default ESD constructor
53 fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.;
54 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = 0.;
57 //_______________________________________________________________________
58 AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
61 fClusterType(clus.fClusterType),
62 fEMCALCluster(clus.fEMCALCluster),
63 fEnergy(clus.fEnergy),
64 fDispersion(clus.fDispersion),
66 fPrimaryIndex(clus.fPrimaryIndex),
70 fNExMax(clus.fNExMax),
71 fEmcCpvDistance(clus.fEmcCpvDistance),
72 fNumberOfDigits(clus.fNumberOfDigits)
75 // The copy constructor
77 fGlobalPos[0] = clus.fGlobalPos[0];
78 fGlobalPos[1] = clus.fGlobalPos[1];
79 fGlobalPos[2] = clus.fGlobalPos[2];
81 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i];
83 fDigitAmplitude = 0x0;
87 if (clus.fNumberOfDigits > 0) {
88 if (clus.fDigitAmplitude) {
89 fDigitAmplitude = new UShort_t[clus.fNumberOfDigits];
90 for (Int_t i=0; i<clus.fNumberOfDigits; i++)
91 fDigitAmplitude[i]=clus.fDigitAmplitude[i];
93 if (clus.fDigitTime) {
94 fDigitTime = new UShort_t[clus.fNumberOfDigits];
95 for (Int_t i=0; i<clus.fNumberOfDigits; i++)
96 fDigitTime[i]=clus.fDigitTime[i];
98 if (clus.fDigitIndex) {
99 fDigitIndex = new UShort_t[clus.fNumberOfDigits];
100 for (Int_t i=0; i<clus.fNumberOfDigits; i++)
101 fDigitIndex[i]=clus.fDigitIndex[i];
107 //_______________________________________________________________________
108 AliESDCaloCluster::~AliESDCaloCluster(){
110 // This is destructor according Coding Conventrions
112 // AliESDCaloCluster is the owner of the arrays
113 // even if they are created outside
115 delete[] fDigitAmplitude;
117 delete[] fDigitIndex;
121 //_______________________________________________________________________
122 void AliESDCaloCluster::SetPid(const Float_t *p) {
123 // Sets the probability of each particle type
124 // Copied from AliESDtrack SetPIDValues
125 // This function copies "n" PID weights from "scr" to "dest"
126 // and normalizes their sum to 1 thus producing conditional
128 // The negative weights are set to 0.
129 // In case all the weights are non-positive they are replaced by
130 // uniform probabilities
132 Int_t n = AliPID::kSPECIESN;
134 Float_t uniform = 1./(Float_t)n;
137 for (Int_t i=0; i<n; i++)
147 for (Int_t i=0; i<n; i++) fPID[i] /= sum;
149 for (Int_t i=0; i<n; i++) fPID[i] = uniform;