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 = clus.fDigitAmplitude;
84 fDigitTime = clus.fDigitTime;
85 fDigitIndex = clus.fDigitIndex;
90 //_______________________________________________________________________
91 AliESDCaloCluster::~AliESDCaloCluster(){
93 // This is destructor according Coding Conventrions
95 //printf("Delete cluster\n");
97 //Not sure why but it won't let me delete these in the dtor here.
98 //The Reconstruction gives me the error
99 //*** glibc detected *** double free or corruption (!prev):
103 delete[] fDigitAmplitude;
107 delete[] fDigitIndex;
111 //_______________________________________________________________________
112 void AliESDCaloCluster::SetPid(const Float_t *p) {
113 // Sets the probability of each particle type
114 // Copied from AliESDtrack SetPIDValues
115 // This function copies "n" PID weights from "scr" to "dest"
116 // and normalizes their sum to 1 thus producing conditional
118 // The negative weights are set to 0.
119 // In case all the weights are non-positive they are replaced by
120 // uniform probabilities
122 Int_t n = AliPID::kSPECIESN;
124 Float_t uniform = 1./(Float_t)n;
127 for (Int_t i=0; i<n; i++)
137 for (Int_t i=0; i<n; i++) fPID[i] /= sum;
139 for (Int_t i=0; i<n; i++) fPID[i] = uniform;