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