Changes in the ACORDE libraries to compile on Windows/Cygwin
[u/mrichter/AliRoot.git] / STEER / AliAODCaloCluster.cxx
CommitLineData
fa86343a 1/**************************************************************************
2 * Copyright(c) 1998-2007, 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
18//-------------------------------------------------------------------------
19// AOD calorimeter cluster class (for PHOS and EMCAL)
20// Author: Markus Oldenburg, CERN
21//-------------------------------------------------------------------------
22
23#include "AliAODCaloCluster.h"
24
25ClassImp(AliAODCaloCluster)
26
27//______________________________________________________________________________
28AliAODCaloCluster::AliAODCaloCluster() :
29 AliAODCluster(),
30 fDistToBadChannel(-999.),
31 fDispersion(-1),
32 fM20(0.),
fa86343a 33 fM02(0.),
34 fM11(0.),
35 fEmcCpvDistance(-999.),
36 fNExMax(0),
37 fTracksMatched(),
e649177a 38 fNCells(0),
39 fCellsAbsId(),
40 fCellsAmpFraction()
fa86343a 41{
42 // default constructor
43
44}
45
46//______________________________________________________________________________
47AliAODCaloCluster::AliAODCaloCluster(Int_t id,
48 UInt_t nLabel,
49 Int_t *label,
50 Double_t energy,
51 Double_t x[3],
52 Double_t pid[9],
53 Char_t ttype,
54 UInt_t selectInfo) :
55 AliAODCluster(id, nLabel, label, energy, x, pid, ttype, selectInfo),
56 fDistToBadChannel(-999.),
57 fDispersion(-1),
58 fM20(0.),
fa86343a 59 fM02(0.),
60 fM11(0.),
61 fEmcCpvDistance(-999.),
62 fNExMax(0),
63 fTracksMatched(),
e649177a 64 fNCells(0),
65 fCellsAbsId(),
66 fCellsAmpFraction()
fa86343a 67{
68 // constructor
69
70}
71
72//______________________________________________________________________________
73AliAODCaloCluster::AliAODCaloCluster(Int_t id,
74 UInt_t nLabel,
75 Int_t *label,
76 Float_t energy,
77 Float_t x[3],
78 Float_t pid[9],
79 Char_t ttype,
80 UInt_t selectInfo) :
81 AliAODCluster(id, nLabel, label, energy, x, pid, ttype, selectInfo),
82 fDistToBadChannel(-999.),
83 fDispersion(-1),
84 fM20(0.),
fa86343a 85 fM02(0.),
86 fM11(0.),
87 fEmcCpvDistance(-999.),
88 fNExMax(0),
89 fTracksMatched(),
e649177a 90 fNCells(0),
91 fCellsAbsId(),
92 fCellsAmpFraction()
fa86343a 93{
94 // constructor
95}
96
97
98//______________________________________________________________________________
99AliAODCaloCluster::~AliAODCaloCluster()
100{
101 // destructor
e649177a 102 if(fCellsAmpFraction) delete[] fCellsAmpFraction; fCellsAmpFraction=0;
103 if(fCellsAbsId) delete[] fCellsAbsId; fCellsAbsId = 0;
fa86343a 104}
105
106
107//______________________________________________________________________________
108AliAODCaloCluster::AliAODCaloCluster(const AliAODCaloCluster& clus) :
109 AliAODCluster(clus),
110 fDistToBadChannel(clus.fDistToBadChannel),
111 fDispersion(clus.fDispersion),
112 fM20(clus.fM20),
fa86343a 113 fM02(clus.fM02),
114 fM11(clus.fM11),
115 fEmcCpvDistance(clus.fEmcCpvDistance),
116 fNExMax(clus.fNExMax),
117 fTracksMatched(clus.fTracksMatched),
e649177a 118 fNCells(clus.fNCells),
119 fCellsAbsId(),
120 fCellsAmpFraction()
fa86343a 121{
122 // Copy constructor
e649177a 123
124 if (clus.fNCells > 0) {
125
126 if(clus.fCellsAbsId){
127 fCellsAbsId = new UShort_t[clus.fNCells];
128 for (Int_t i=0; i<clus.fNCells; i++)
129 fCellsAbsId[i]=clus.fCellsAbsId[i];
130 }
131
132 if(clus.fCellsAmpFraction){
133 fCellsAmpFraction = new Double32_t[clus.fNCells];
134 for (Int_t i=0; i<clus.fNCells; i++)
135 fCellsAmpFraction[i]=clus.fCellsAmpFraction[i];
136 }
137
138 }
139
fa86343a 140}
141
142//______________________________________________________________________________
143AliAODCaloCluster& AliAODCaloCluster::operator=(const AliAODCaloCluster& clus)
144{
145 // Assignment operator
146 if(this!=&clus) {
147
148 AliAODCluster::operator=(clus);
149
150 fDistToBadChannel = clus.fDistToBadChannel;
151 fDispersion = clus.fDispersion;
152 fM20 = clus.fM20;
fa86343a 153 fM02 = clus.fM02;
154 fM11 = clus.fM11;
155 fEmcCpvDistance = clus.fEmcCpvDistance;
156 fNExMax = clus.fNExMax;
157 fTracksMatched = clus.fTracksMatched;
e649177a 158
159 fNCells= clus. fNCells;
160 if (clus.fNCells > 0) {
161
162 if(clus.fCellsAbsId){
163 fCellsAbsId = new UShort_t[clus.fNCells];
164 for (Int_t i=0; i<clus.fNCells; i++)
165 fCellsAbsId[i]=clus.fCellsAbsId[i];
166 }
167
168 if(clus.fCellsAmpFraction){
169 fCellsAmpFraction = new Double32_t[clus.fNCells];
170 for (Int_t i=0; i<clus.fNCells; i++)
171 fCellsAmpFraction[i]=clus.fCellsAmpFraction[i];
172 }
173
174 }
175
fa86343a 176 }
177
178 return *this;
179}
180
181//_______________________________________________________________________
182Bool_t AliAODCaloCluster::HasTrackMatched(TObject *trk) const
183{
184 // Checks if the given track contributed to this cluster.
185
186 TRefArrayIter iter(&fTracksMatched);
187 while (TObject *track = iter.Next()) {
188 if (trk == track) return kTRUE;
189 }
190 return kFALSE;
191}