Fix effc++ warnings.
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveEMCALSModuleData.cxx
CommitLineData
c3e34498 1//*************************************************************************
2// EMCAL event display
3// Store the data related to each Super Module (SM)
4// Possible storage of hits, digits and clusters per SM
5//
6// Author: Magali Estienne (magali.estienne@cern.ch)
7// June 30 2008
8//*************************************************************************
9
10#include <Riostream.h>
c3e34498 11
12#include "AliEveEMCALSModuleData.h"
13
14#include <AliEMCALGeometry.h>
15
16#include <TVector2.h>
17#include <TVectorT.h>
18#include <TClonesArray.h>
19#include <TGeoNode.h>
20#include <TGeoBBox.h>
21#include <TGeoMatrix.h>
22
23#include <EveBase/AliEveEventManager.h>
24
c3e34498 25ClassImp(AliEveEMCALSModuleData)
26
27Float_t AliEveEMCALSModuleData::fSModuleBigBox0 = 0.;
28Float_t AliEveEMCALSModuleData::fSModuleBigBox1 = 0.;
29Float_t AliEveEMCALSModuleData::fSModuleBigBox2 = 0.;
30Float_t AliEveEMCALSModuleData::fSModuleSmallBox0 = 0.;
31Float_t AliEveEMCALSModuleData::fSModuleSmallBox1 = 0.;
32Float_t AliEveEMCALSModuleData::fSModuleSmallBox2 = 0.;
33Float_t AliEveEMCALSModuleData::fSModuleCenter0 = 0.;
34Float_t AliEveEMCALSModuleData::fSModuleCenter1 = 0.;
35Float_t AliEveEMCALSModuleData::fSModuleCenter2 = 0.;
36
37//______________________________________________________________________________
38AliEveEMCALSModuleData::AliEveEMCALSModuleData(Int_t sm,AliEMCALGeometry* geom, TGeoNode* node, TGeoHMatrix* m) :
39 TObject(),
40 fGeom(geom),
41 fNode(node),
42 fSmId(sm),
43 fNsm(0),
44 fNsmfull(0),
45 fNsmhalf(0),
46 fNDigits(0),
47 fNClusters(0),
48 fNHits(0),
3607f2fb 49 fPhiTileSize(0), fEtaTileSize(0),
c3e34498 50 fHitArray(0),
51 fDigitArray(0),
52 fClusterArray(0),
53 fMatrix(0),
54 fHMatrix(m)
55{
56 //
a312477b 57 // Constructor
c3e34498 58 //
59
60 Init(sm);
61
62}
63
64//______________________________________________________________________________
65 AliEveEMCALSModuleData::AliEveEMCALSModuleData(const AliEveEMCALSModuleData &esmdata) :
66 TObject(),
67 fGeom(esmdata.fGeom),
68 fNode(esmdata.fNode),
69 fSmId(esmdata.fSmId),
70 fNsm(esmdata.fNsm),
71 fNsmfull(esmdata.fNsmfull),
72 fNsmhalf(esmdata.fNsmhalf),
73 fNDigits(esmdata.fNDigits),
74 fNClusters(esmdata.fNClusters),
75 fNHits(esmdata.fNHits),
3607f2fb 76 fPhiTileSize(esmdata.fPhiTileSize), fEtaTileSize(esmdata.fEtaTileSize),
c3e34498 77 fHitArray(esmdata.fHitArray),
78 fDigitArray(esmdata.fDigitArray),
79 fClusterArray(esmdata.fClusterArray),
80 fMatrix(esmdata.fMatrix),
81 fHMatrix(esmdata.fHMatrix)
82{
83 //
a312477b 84 // Copy constructor
c3e34498 85 //
86
87 Init(esmdata.fNsm);
88
89}
90
91//______________________________________________________________________________
92AliEveEMCALSModuleData::~AliEveEMCALSModuleData()
93{
94 //
a312477b 95 // Destructor
c3e34498 96 //
97
98 if(!fHitArray.empty()){
99 fHitArray.clear();
100 }
101 if(!fDigitArray.empty()){
102 fDigitArray.clear();
103 }
104 if(!fClusterArray.empty()){
105 fClusterArray.clear();
106 }
107
108}
109
110//______________________________________________________________________________
111void AliEveEMCALSModuleData::DropData()
112{
113 //
a312477b 114 // Release the SM data
c3e34498 115 //
116
117 fNDigits = 0;
118 fNClusters = 0;
119 fNHits = 0;
120
121 if(!fHitArray.empty())
122 fHitArray.clear();
123
124 if(!fDigitArray.empty())
125 fDigitArray.clear();
126
127 if(!fClusterArray.empty())
128 fClusterArray.clear();
129
130 return;
131
132}
133
134// ______________________________________________________________________________
135void AliEveEMCALSModuleData::Init(Int_t sm)
136{
a312477b 137
138 //
139 // Initialize parameters
140 //
141
c3e34498 142 fNsm = 12;
143 fNsmfull = 10;
144 fNsmhalf = 2;
145
146 fPhiTileSize = fGeom->GetPhiTileSize();
147 fEtaTileSize = fGeom->GetPhiTileSize();
148
149 TGeoBBox* bbbox = (TGeoBBox*) fNode->GetDaughter(0) ->GetVolume()->GetShape();
150 bbbox->Dump();
151 TGeoBBox* sbbox = (TGeoBBox*) fNode->GetDaughter(10)->GetVolume()->GetShape();
152 sbbox->Dump();
153
154 fMatrix = (TGeoMatrix*) fNode->GetDaughter(sm)->GetMatrix();
155
156 if(sm<fNsmfull)
157 {
158 fSModuleBigBox0 = bbbox->GetDX();
159 fSModuleBigBox1 = bbbox->GetDY();
160 fSModuleBigBox2 = bbbox->GetDZ();
161 }
162 else
163 {
164 fSModuleSmallBox0 = sbbox->GetDX();
165 fSModuleSmallBox1 = sbbox->GetDY();
166 fSModuleSmallBox2 = sbbox->GetDZ();
167 }
168}
169
170
171// ______________________________________________________________________________
a312477b 172void AliEveEMCALSModuleData::RegisterDigit(Int_t AbsId, Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
c3e34498 173{
174 //
a312477b 175 // Add a digit to this SM
c3e34498 176 //
177
97425cab 178 std::vector<Double_t> bufDig(6);
c3e34498 179 bufDig[0] = AbsId;
180 bufDig[1] = isupMod;
181 bufDig[2] = iamp;
182 bufDig[3] = ix;
183 bufDig[4] = iy;
184 bufDig[5] = iz;
185
c3e34498 186 fDigitArray.push_back(bufDig);
187
188 fNDigits++;
189
190}
191
192// ______________________________________________________________________________
a312477b 193void AliEveEMCALSModuleData::RegisterHit(Int_t AbsId, Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
c3e34498 194{
195 //
a312477b 196 // Add a hit to this SM
c3e34498 197 //
198
97425cab 199 std::vector<Float_t> bufHit(6);
c3e34498 200 bufHit[0] = AbsId;
201 bufHit[1] = isupMod;
202 bufHit[2] = iamp;
203 bufHit[3] = ix;
204 bufHit[4] = iy;
205 bufHit[5] = iz;
206
207 fHitArray.push_back(bufHit);
208
209 fNHits++;
210
211}
212
213// ______________________________________________________________________________
a312477b 214void AliEveEMCALSModuleData::RegisterCluster(Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
c3e34498 215{
216 //
a312477b 217 // Add a cluster to this SM
c3e34498 218 //
219
97425cab 220 std::vector<Double_t> bufClu(5);
c3e34498 221 bufClu[0] = isupMod;
222 bufClu[1] = iamp;
223 bufClu[2] = ix;
224 bufClu[3] = iy;
225 bufClu[4] = iz;
226
227 fClusterArray.push_back(bufClu);
228
229 fNClusters++;
230
231}