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