]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveEMCALSModuleData.cxx
update for the new location of TRD performance train
[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   TGeoBBox* sbbox = (TGeoBBox*) fNode->GetDaughter(10)->GetVolume()->GetShape();
151
152   fMatrix = (TGeoMatrix*) fNode->GetDaughter(sm)->GetMatrix();
153
154   if(sm<fNsmfull)
155     {
156       fSModuleBigBox0 = bbbox->GetDX();
157       fSModuleBigBox1 = bbbox->GetDY();
158       fSModuleBigBox2 = bbbox->GetDZ();
159     }
160   else 
161     {
162       fSModuleSmallBox0 = sbbox->GetDX();
163       fSModuleSmallBox1 = sbbox->GetDY();
164       fSModuleSmallBox2 = sbbox->GetDZ();
165     }
166 }
167
168
169 // ______________________________________________________________________________
170 void AliEveEMCALSModuleData::RegisterDigit(Int_t AbsId, Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
171 {
172   //
173   // Add a digit to this SM
174   //
175
176   std::vector<Double_t> bufDig(6);
177   bufDig[0] = AbsId;
178   bufDig[1] = isupMod;
179   bufDig[2] = iamp;
180   bufDig[3] = ix;
181   bufDig[4] = iy;
182   bufDig[5] = iz;
183
184   fDigitArray.push_back(bufDig);
185
186   fNDigits++;
187
188 }
189
190 // ______________________________________________________________________________
191 void AliEveEMCALSModuleData::RegisterHit(Int_t AbsId, Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
192 {
193   //
194   // Add a hit to this SM
195   //
196
197   std::vector<Float_t> bufHit(6);
198   bufHit[0] = AbsId;
199   bufHit[1] = isupMod;
200   bufHit[2] = iamp;
201   bufHit[3] = ix;
202   bufHit[4] = iy;
203   bufHit[5] = iz;
204
205   fHitArray.push_back(bufHit);
206
207   fNHits++;
208
209 }
210
211 // ______________________________________________________________________________
212 void AliEveEMCALSModuleData::RegisterCluster(Int_t isupMod, Double_t iamp, Double_t ix, Double_t iy, Double_t iz)
213 {
214   //
215   // Add a cluster to this SM
216   //
217
218   std::vector<Double_t> bufClu(5);
219   bufClu[0] = isupMod;
220   bufClu[1] = iamp;
221   bufClu[2] = ix;
222   bufClu[3] = iy;
223   bufClu[4] = iz;
224
225   fClusterArray.push_back(bufClu);
226
227   fNClusters++;
228
229 }