]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDCaloCluster.cxx
new digitization and reconstruction corresponded to new data format
[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),
36 fEnergy(-1),
37 fDispersion(-1),
38 fChi2(-1),
e3e93796 39 fPrimaryIndex(-1),
40 fM20(0),
41 fM02(0),
42 fM11(0),
43 fNExMax(0),
44 fEmcCpvDistance(9999),
85c60a8e 45 fNumberOfDigits(0),
46 fDigitAmplitude(0),
47 fDigitTime(0),
48 fDigitIndex(0)
49{
50 //
51 // The default ESD constructor
52 //
53 fGlobalPos[0] = fGlobalPos[1] = fGlobalPos[2] = 0.;
54 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = 0.;
55}
56
57//_______________________________________________________________________
58AliESDCaloCluster::AliESDCaloCluster(const AliESDCaloCluster& clus) :
59 TObject(clus),
60 fID(clus.fID),
61 fClusterType(clus.fClusterType),
62 fEMCALCluster(clus.fEMCALCluster),
63 fEnergy(clus.fEnergy),
64 fDispersion(clus.fDispersion),
65 fChi2(clus.fChi2),
e3e93796 66 fPrimaryIndex(clus.fPrimaryIndex),
67 fM20(clus.fM20),
68 fM02(clus.fM02),
69 fM11(clus.fNExMax),
70 fNExMax(clus.fNExMax),
71 fEmcCpvDistance(clus.fEmcCpvDistance),
85c60a8e 72 fNumberOfDigits(clus.fNumberOfDigits)
73{
74 //
75 // The copy constructor
76 //
77 fGlobalPos[0] = clus.fGlobalPos[0];
78 fGlobalPos[1] = clus.fGlobalPos[1];
79 fGlobalPos[2] = clus.fGlobalPos[2];
80
81 for(Int_t i=0; i<AliPID::kSPECIESN; i++) fPID[i] = clus.fPID[i];
82
83 fDigitAmplitude = clus.fDigitAmplitude;
84 fDigitTime = clus.fDigitTime;
85 fDigitIndex = clus.fDigitIndex;
86
87}
88
89
90//_______________________________________________________________________
91AliESDCaloCluster::~AliESDCaloCluster(){
92 //
93 // This is destructor according Coding Conventrions
94 //
95 //printf("Delete cluster\n");
96
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):
100 //0x0c1550b0 ***
101 /*
102 if(fDigitAmplitude)
103 delete[] fDigitAmplitude;
104 if(fDigitTime)
105 delete[] fDigitTime;
106 if(fDigitIndex)
107 delete[] fDigitIndex;
108 */
109}
110
111//_______________________________________________________________________
112void 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
117 // probabilities.
118 // The negative weights are set to 0.
119 // In case all the weights are non-positive they are replaced by
120 // uniform probabilities
121
122 Int_t n = AliPID::kSPECIESN;
123
124 Float_t uniform = 1./(Float_t)n;
125
126 Float_t sum = 0;
127 for (Int_t i=0; i<n; i++)
128 if (p[i]>=0) {
129 sum+=p[i];
130 fPID[i] = p[i];
131 }
132 else {
133 fPID[i] = 0;
134 }
135
136 if(sum>0)
137 for (Int_t i=0; i<n; i++) fPID[i] /= sum;
138 else
139 for (Int_t i=0; i<n; i++) fPID[i] = uniform;
140
141}