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 <TLorentzVector.h>
28 #include "AliESDCaloCluster.h"
30 ClassImp(AliESDCaloCluster)
32 //_______________________________________________________________________
33 AliESDCaloCluster::AliESDCaloCluster() :
36 fEMCALCluster(kFALSE),
45 fEmcCpvDistance(9999),
46 fDistToBadChannel(9999),
54 // The default ESD constructor
56 fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.;
57 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = 0.;
60 //_______________________________________________________________________
61 AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
64 fClusterType(clus.fClusterType),
65 fEMCALCluster(clus.fEMCALCluster),
66 fPHOSCluster(clus.fPHOSCluster),
67 fEnergy(clus.fEnergy),
68 fDispersion(clus.fDispersion),
73 fNExMax(clus.fNExMax),
74 fEmcCpvDistance(clus.fEmcCpvDistance),
75 fDistToBadChannel(clus.fDistToBadChannel),
76 fTracksMatched(clus.fTracksMatched),
77 fLabels(clus.fLabels),
78 fDigitAmplitude(clus.fDigitAmplitude),
79 fDigitTime(clus.fDigitTime),
80 fDigitIndex(clus.fDigitIndex)
83 // The copy constructor
85 fGlobalPos[0] = clus.fGlobalPos[0];
86 fGlobalPos[1] = clus.fGlobalPos[1];
87 fGlobalPos[2] = clus.fGlobalPos[2];
89 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i];
93 //_______________________________________________________________________
94 AliESDCaloCluster &AliESDCaloCluster::operator=(const AliESDCaloCluster& source)
96 // assignment operator
98 if(&source == this) return *this;
101 fClusterType = source.fClusterType;
102 fEMCALCluster = source.fEMCALCluster;
103 fPHOSCluster = source.fPHOSCluster;
104 fEnergy = source.fEnergy;
105 fDispersion = source.fDispersion;
106 fChi2 = source.fChi2;
110 fNExMax = source.fNExMax;
111 fEmcCpvDistance = source.fEmcCpvDistance;
112 fDistToBadChannel = source.fDistToBadChannel ;
114 fGlobalPos[0] = source.fGlobalPos[0];
115 fGlobalPos[1] = source.fGlobalPos[1];
116 fGlobalPos[2] = source.fGlobalPos[2];
118 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = source.fPID[i];
120 fTracksMatched = source.fTracksMatched;
121 fLabels = source.fLabels;
122 fDigitAmplitude = source.fDigitAmplitude;
123 fDigitTime = source.fDigitTime;
124 fDigitIndex = source.fDigitIndex;
132 //_______________________________________________________________________
133 AliESDCaloCluster::~AliESDCaloCluster(){
135 // This is destructor according Coding Conventions
137 delete fTracksMatched;
139 delete fDigitAmplitude;
145 //_______________________________________________________________________
146 void AliESDCaloCluster::SetPid(const Float_t *p) {
147 // Sets the probability of each particle type
148 // Copied from AliESDtrack SetPIDValues
149 // This function copies "n" PID weights from "scr" to "dest"
150 // and normalizes their sum to 1 thus producing conditional
152 // The negative weights are set to 0.
153 // In case all the weights are non-positive they are replaced by
154 // uniform probabilities
156 Int_t n = AliPID::kSPECIESN;
158 Float_t uniform = 1./(Float_t)n;
161 for (Int_t i=0; i<n; i++)
171 for (Int_t i=0; i<n; i++) fPID[i] /= sum;
173 for (Int_t i=0; i<n; i++) fPID[i] = uniform;
177 //_______________________________________________________________________
178 void AliESDCaloCluster::GetMomentum(TLorentzVector& p, Double_t *vertex ) {
179 // Returns TLorentzVector with momentum of the cluster. Only valid for clusters
180 // identified as photons or pi0 (overlapped gamma) produced on the vertex
181 //Vertex can be recovered with esd pointer doing:
182 //" Double_t vertex[3] ; esd->GetVertex()->GetXYZ(vertex) ; "
184 if(vertex){//calculate direction from vertex
185 fGlobalPos[0]-=vertex[0];
186 fGlobalPos[1]-=vertex[1];
187 fGlobalPos[2]-=vertex[2];
190 Double_t r = TMath::Sqrt(fGlobalPos[0]*fGlobalPos[0]+
191 fGlobalPos[1]*fGlobalPos[1]+
192 fGlobalPos[2]*fGlobalPos[2] ) ;
194 p.SetPxPyPzE( fEnergy*fGlobalPos[0]/r, fEnergy*fGlobalPos[1]/r, fEnergy*fGlobalPos[2]/r, fEnergy) ;