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