]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveEMCALSModuleData.cxx
Fix effc++ warnings.
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveEMCALSModuleData.cxx
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>
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
25 ClassImp(AliEveEMCALSModuleData)
26
27 Float_t AliEveEMCALSModuleData::fSModuleBigBox0 = 0.;
28 Float_t AliEveEMCALSModuleData::fSModuleBigBox1 = 0.;
29 Float_t AliEveEMCALSModuleData::fSModuleBigBox2 = 0.;
30 Float_t AliEveEMCALSModuleData::fSModuleSmallBox0 = 0.;
31 Float_t AliEveEMCALSModuleData::fSModuleSmallBox1 = 0.;
32 Float_t AliEveEMCALSModuleData::fSModuleSmallBox2 = 0.;
33 Float_t AliEveEMCALSModuleData::fSModuleCenter0 = 0.;
34 Float_t AliEveEMCALSModuleData::fSModuleCenter1 = 0.;
35 Float_t AliEveEMCALSModuleData::fSModuleCenter2 = 0.;
36
37 //______________________________________________________________________________
38 AliEveEMCALSModuleData::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),
49   fPhiTileSize(0), fEtaTileSize(0),
50   fHitArray(0),
51   fDigitArray(0),
52   fClusterArray(0),
53   fMatrix(0),
54   fHMatrix(m)
55 {
56   //
57   // Constructor
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),
76   fPhiTileSize(esmdata.fPhiTileSize), fEtaTileSize(esmdata.fEtaTileSize),
77   fHitArray(esmdata.fHitArray),
78   fDigitArray(esmdata.fDigitArray),
79   fClusterArray(esmdata.fClusterArray),
80   fMatrix(esmdata.fMatrix),
81   fHMatrix(esmdata.fHMatrix)
82 {
83   //
84   // Copy constructor
85   //
86
87   Init(esmdata.fNsm);
88
89 }
90
91 //______________________________________________________________________________
92 AliEveEMCALSModuleData::~AliEveEMCALSModuleData()
93 {
94   //
95   // Destructor
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 //______________________________________________________________________________
111 void AliEveEMCALSModuleData::DropData()
112 {
113   //
114   // Release the SM data
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 // ______________________________________________________________________________
135 void AliEveEMCALSModuleData::Init(Int_t sm)
136 {
137
138   //
139   // Initialize parameters
140   //
141
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 // ______________________________________________________________________________
172 void AliEveEMCALSModuleData::RegisterDigit(Int_t AbsId, Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
173 {
174   //
175   // Add a digit to this SM
176   //
177
178   std::vector<Double_t> bufDig(6);
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
186   fDigitArray.push_back(bufDig);
187
188   fNDigits++;
189
190 }
191
192 // ______________________________________________________________________________
193 void AliEveEMCALSModuleData::RegisterHit(Int_t AbsId, Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
194 {
195   //
196   // Add a hit to this SM
197   //
198
199   std::vector<Float_t> bufHit(6);
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 // ______________________________________________________________________________
214 void AliEveEMCALSModuleData::RegisterCluster(Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
215 {
216   //
217   // Add a cluster to this SM
218   //
219
220   std::vector<Double_t> bufClu(5);
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 }