]>
Commit | Line | Data |
---|---|---|
345a46b0 | 1 | // |
c3e34498 | 2 | // Fill containers for visualisation of EMCAL data structures |
345a46b0 | 3 | // - read and store MC Hits - read and store digits from esds or runloader |
c3e34498 | 4 | // - read and store clusters from esds or runloader |
5 | // | |
6 | // Author: Magali Estienne (magali.estienne@cern.ch) | |
7 | // June 30 2008 | |
345a46b0 | 8 | // |
9 | ||
10 | //#include <Riostream.h> | |
11 | //#include <vector> | |
c3e34498 | 12 | |
c3e34498 | 13 | #include <TTree.h> |
14 | #include <TBranch.h> | |
15 | #include <TObjArray.h> | |
16 | #include <TRefArray.h> | |
17 | #include <TClonesArray.h> | |
d05591ca | 18 | #include <TMath.h> |
19 | #include <TLorentzVector.h> | |
c3e34498 | 20 | |
c3e34498 | 21 | #include "AliRunLoader.h" |
c757605d | 22 | #include "AliEMCAL.h" |
c3e34498 | 23 | #include "AliEMCALLoader.h" |
c3e34498 | 24 | #include "AliESDVertex.h" |
c3e34498 | 25 | #include "AliEMCALHit.h" |
26 | #include "AliEMCALDigit.h" | |
ef3891ac | 27 | |
c3e34498 | 28 | #include "AliEMCALRecPoint.h" |
29 | #include "AliESDCaloCells.h" | |
30 | #include "AliESDCaloCluster.h" | |
31 | ||
32 | #include "AliEveEMCALData.h" | |
c3e34498 | 33 | #include "AliEveEMCALSModuleData.h" |
34 | ||
345a46b0 | 35 | class Riostream; |
36 | class TObject; | |
37 | class TEveUtil; | |
38 | class TEvePointSet; | |
39 | class AliRun; | |
40 | class AliESDEvent; | |
41 | class AliEMCAL; | |
42 | class AliEMCALGeometry; | |
43 | class AliEveEMCALSModule; | |
44 | ||
c82bb898 | 45 | using std::cout; |
46 | using std::endl; | |
c3e34498 | 47 | ClassImp(AliEveEMCALData) |
48 | ||
49 | //______________________________________________________________________________ | |
50 | AliEveEMCALData::AliEveEMCALData(): | |
51 | TObject(), | |
52 | TEveRefCnt(), | |
53 | fEmcal(0x0), | |
54 | fGeom(0x0), | |
55 | fNode(0x0), | |
56 | fHMatrix(0), | |
57 | fTree(0x0), | |
58 | fESD(0x0), | |
59 | fNsm(12), | |
60 | fNsmfull(10), | |
61 | fNsmhalf(2), | |
62 | fSM(12), | |
63 | fSMfull(10), | |
64 | fSMhalf(2), | |
65 | fRunLoader(0), | |
66 | fDebug(0), | |
67 | fPoint(0) | |
68 | { | |
69 | ||
70 | // | |
71 | // Constructor | |
72 | // | |
73 | // for(Int_t i=0; i<12; i++) | |
74 | // fSM[i] = 0x0; | |
75 | // for(Int_t i=0; i<10; i++) | |
76 | // fSMfull[i] = 0x0; | |
77 | // fSMhalf[0] = fSMhalf[1] = 0x0; | |
78 | // InitEMCALGeom(); | |
79 | CreateAllSModules(); | |
80 | ||
81 | ||
82 | } | |
83 | ||
84 | //______________________________________________________________________________ | |
85 | AliEveEMCALData::AliEveEMCALData(AliRunLoader* rl, TGeoNode* node, TGeoHMatrix* m): | |
86 | TObject(), | |
87 | TEveRefCnt(), | |
88 | fEmcal(0x0), | |
89 | fGeom(0x0), | |
90 | fNode(node), | |
91 | fHMatrix(m), | |
92 | fTree(0x0), | |
93 | fESD(0x0), | |
94 | fNsm(12), | |
95 | fNsmfull(10), | |
96 | fNsmhalf(2), | |
97 | fSM(12), | |
98 | fSMfull(10), | |
99 | fSMhalf(2), | |
100 | fRunLoader(rl), | |
ef3891ac | 101 | fDebug(0), |
c3e34498 | 102 | fPoint(0) |
103 | { | |
104 | ||
105 | // | |
106 | // Constructor | |
107 | // | |
108 | // for(Int_t i=0; i<12; i++) | |
109 | // fSM[i] = 0x0; | |
110 | // for(Int_t i=0; i<10; i++) | |
111 | // fSMfull[i] = 0x0; | |
112 | // fSMhalf[0] = fSMhalf[1] = 0x0; | |
113 | InitEMCALGeom(rl); | |
114 | CreateAllSModules(); | |
115 | ||
116 | ||
117 | } | |
118 | ||
119 | //______________________________________________________________________________ | |
120 | AliEveEMCALData::~AliEveEMCALData() | |
121 | { | |
122 | // | |
123 | // Destructor | |
124 | // | |
125 | ||
126 | DeleteSuperModules(); | |
127 | delete fTree; | |
ef3891ac | 128 | // delete fEmcal; // deleted by run-loader |
c3e34498 | 129 | delete fGeom; |
130 | delete fNode; | |
131 | delete fHMatrix; | |
132 | delete fPoint; | |
133 | } | |
134 | ||
c3e34498 | 135 | //______________________________________________________________________________ |
136 | AliEveEMCALData::AliEveEMCALData(const AliEveEMCALData &edata) : | |
137 | TObject(edata), | |
138 | TEveRefCnt(edata), | |
139 | fEmcal(edata.fEmcal), | |
140 | fGeom(edata.fGeom), | |
141 | fNode(edata.fNode), | |
142 | fHMatrix(edata.fHMatrix), | |
143 | fTree(edata.fTree), | |
144 | fESD(edata.fESD), | |
145 | fNsm(edata.fNsm), | |
146 | fNsmfull(edata.fNsmfull), | |
147 | fNsmhalf(edata.fNsmhalf), | |
148 | fSM(edata.fSM), | |
149 | fSMfull(edata.fSMfull), | |
150 | fSMhalf(edata.fSMhalf), | |
151 | fRunLoader(edata.fRunLoader), | |
152 | fDebug(edata.fDebug), | |
153 | fPoint(edata.fPoint) | |
154 | { | |
155 | // | |
156 | // Copy constructor | |
157 | // | |
158 | InitEMCALGeom(edata.fRunLoader); | |
159 | CreateAllSModules(); | |
160 | } | |
161 | ||
162 | //______________________________________________________________________________ | |
163 | AliEveEMCALData& AliEveEMCALData::operator=(const AliEveEMCALData &edata) | |
164 | { | |
165 | // | |
166 | // Assignment operator | |
167 | // | |
168 | ||
169 | if (this != &edata) { | |
170 | ||
171 | } | |
172 | ||
173 | return *this; | |
174 | ||
175 | } | |
176 | ||
177 | //______________________________________________________________________________ | |
345a46b0 | 178 | void AliEveEMCALData::SetTree(TTree* const tree) |
c3e34498 | 179 | { |
a312477b | 180 | // |
181 | // Set digit-tree to be used for digit retrieval. | |
182 | // Data is loaded on demand. | |
183 | // | |
c3e34498 | 184 | |
185 | fTree = tree; | |
186 | ||
187 | } | |
188 | ||
189 | //______________________________________________________________________________ | |
345a46b0 | 190 | void AliEveEMCALData::SetESD(AliESDEvent* const esd) |
c3e34498 | 191 | { |
a312477b | 192 | // |
193 | // Set esd | |
194 | // | |
195 | ||
c3e34498 | 196 | fESD = esd; |
197 | } | |
198 | ||
199 | //______________________________________________________________________________ | |
345a46b0 | 200 | void AliEveEMCALData::SetNode(TGeoNode* const node) |
c3e34498 | 201 | { |
a312477b | 202 | // |
203 | // Set node | |
204 | // | |
205 | ||
c3e34498 | 206 | fNode = node; |
207 | } | |
208 | ||
209 | //______________________________________________________________________________ | |
345a46b0 | 210 | void AliEveEMCALData::InitEMCALGeom(AliRunLoader* const rl) |
c3e34498 | 211 | { |
a312477b | 212 | // |
213 | // Set data members for EMCAL geometry | |
214 | // | |
c3e34498 | 215 | |
c3e34498 | 216 | fEmcal = (AliEMCAL*) rl->GetAliRun()->GetDetector("EMCAL"); |
217 | fGeom = (AliEMCALGeometry*) fEmcal->GetGeometry(); | |
218 | ||
219 | } | |
220 | ||
221 | //______________________________________________________________________________ | |
222 | void AliEveEMCALData::GetGeomInfo(Int_t id, Int_t &iSupMod, Double_t& x, Double_t& y, Double_t& z) | |
223 | { | |
a312477b | 224 | // |
c3e34498 | 225 | // Get geometrical information from hit/digit/cluster absolute id |
a312477b | 226 | // |
c3e34498 | 227 | |
228 | Int_t iTower = 0 ; | |
229 | Int_t iIphi = 0 ; | |
230 | Int_t iIeta = 0 ; | |
c3e34498 | 231 | |
232 | //Geometry methods | |
233 | fGeom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta); | |
234 | //Gives SuperModule and Tower numbers | |
235 | fGeom->RelPosCellInSModule(id, x, y, z); | |
236 | ||
237 | } | |
238 | ||
239 | //______________________________________________________________________________ | |
240 | void AliEveEMCALData::CreateAllSModules() | |
241 | { | |
a312477b | 242 | // |
c3e34498 | 243 | // Create all fNsm super modules |
a312477b | 244 | // |
245 | ||
c3e34498 | 246 | for(Int_t sm = 0; sm < fNsm; sm++) |
247 | CreateSModule(sm); | |
248 | ||
249 | } | |
250 | ||
251 | //______________________________________________________________________________ | |
252 | void AliEveEMCALData::CreateSModule(Int_t sm) | |
253 | { | |
a312477b | 254 | // |
255 | // Create super-module-data for SM if it does not exist already. | |
256 | // | |
257 | ||
c3e34498 | 258 | if(fSM[sm] == 0) fSM[sm] = new AliEveEMCALSModuleData(sm,fGeom,fNode,fHMatrix); |
259 | if(fSMfull[sm] == 0 && sm < 10) fSMfull[sm] = new AliEveEMCALSModuleData(sm,fGeom,fNode,fHMatrix); | |
260 | if(fSMhalf[sm-10] == 0 && sm > 10) fSMhalf[sm-10] = new AliEveEMCALSModuleData(sm,fGeom,fNode,fHMatrix); | |
261 | } | |
262 | ||
263 | //______________________________________________________________________________ | |
264 | void AliEveEMCALData::DropAllSModules() | |
265 | { | |
a312477b | 266 | // |
c3e34498 | 267 | // Drop data of all existing sectors. |
a312477b | 268 | // |
c3e34498 | 269 | |
270 | for (Int_t sm = 0; sm < fNsm; sm++) { | |
271 | if (fSM[sm] != 0) | |
272 | fSM[sm]->DropData(); | |
273 | } | |
274 | } | |
275 | ||
276 | //______________________________________________________________________________ | |
277 | void AliEveEMCALData::DeleteSuperModules() | |
278 | { | |
279 | // | |
a312477b | 280 | // Delete all super module data |
c3e34498 | 281 | // |
282 | ||
283 | for (Int_t sm = 0; sm < fNsm; sm++) | |
284 | { | |
285 | fSM[sm] = 0; | |
286 | delete fSM[sm]; | |
287 | } | |
288 | ||
289 | for(Int_t smf = 0; smf < fNsmfull; smf++) | |
290 | { | |
291 | fSMfull[smf] = 0; | |
292 | delete fSMfull[smf]; | |
293 | } | |
294 | ||
295 | for(Int_t smh = 0; smh < fNsmhalf; smh++) | |
296 | { | |
297 | fSMhalf[smh] = 0; | |
298 | delete fSMhalf[smh]; | |
299 | } | |
300 | ||
301 | } | |
302 | ||
303 | //______________________________________________________________________________ | |
345a46b0 | 304 | void AliEveEMCALData::LoadHits(TTree* const t) |
c3e34498 | 305 | { |
a312477b | 306 | // |
307 | // Get hit information from RunLoader | |
308 | // | |
c3e34498 | 309 | |
a312477b | 310 | /* |
c3e34498 | 311 | // These are global coordinates ! |
312 | char form[1000]; | |
313 | const char *selection = ""; | |
314 | const char *varexp = "fX:fY:fZ"; | |
315 | sprintf(form,"EMCAL Hits '%s'", selection); | |
316 | fPoint = new TEvePointSet(form); | |
317 | ||
318 | TEvePointSelector ps(t, fPoint, varexp, selection); | |
319 | ps.Select(); | |
320 | ||
321 | if (fPoint->Size() == 0) { | |
322 | Warning("emcal_hits", Form("No hits match '%s'", selection)); | |
323 | delete fPoint; | |
324 | // return 0; | |
325 | } | |
a312477b | 326 | */ |
c3e34498 | 327 | |
a312477b | 328 | TObjArray *harr=NULL; |
329 | TBranch *hbranch=t->GetBranch("EMCAL"); | |
330 | hbranch->SetAddress(&harr); | |
c3e34498 | 331 | |
a312477b | 332 | if(hbranch->GetEvent(0)) { |
333 | for(Int_t ih = 0; ih < harr->GetEntriesFast(); ih++) { | |
334 | AliEMCALHit* hit =(AliEMCALHit*)harr->UncheckedAt(ih); | |
335 | if(hit != 0){ | |
336 | if(fDebug>1) cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy() << endl; | |
337 | Int_t id = hit->GetId(); | |
338 | // These are local coordinates | |
339 | Double_t xl = 0.; Double_t yl = 0.; Double_t zl = 0.; | |
340 | // Get global coordinates | |
341 | Double_t x = hit->X(); | |
342 | Double_t y = hit->Y(); | |
343 | Double_t z = hit->Z(); | |
344 | Double_t amp = hit->GetEnergy(); | |
345 | Int_t iSupMod = 0; | |
346 | // Get SM Id | |
347 | GetGeomInfo(id,iSupMod,xl,yl,zl); | |
348 | fSM[iSupMod]->RegisterHit(id,iSupMod,amp,x,y,z); | |
349 | } | |
350 | } | |
351 | } | |
c3e34498 | 352 | } |
353 | ||
354 | //______________________________________________________________________________ | |
345a46b0 | 355 | void AliEveEMCALData::LoadHitsFromEMCALLoader(AliEMCALLoader* const emcl) |
c3e34498 | 356 | { |
a312477b | 357 | // |
358 | // Get hit information from EMCAL Loader | |
359 | // | |
c3e34498 | 360 | |
e44d51bd | 361 | AliEMCALHit* hit; |
c3e34498 | 362 | |
e44d51bd | 363 | //Fill array of hits |
364 | TClonesArray *hits = 0;//(TClonesArray*)emcl->Hits(); | |
365 | TTree *treeH = emcl->TreeH(); | |
366 | if (treeH) { | |
367 | Int_t nTrack = treeH->GetEntries(); // TreeH has array of hits for every primary | |
368 | TBranch * branchH = treeH->GetBranch("EMCAL"); | |
369 | //if(fHits)fHits->Clear(); | |
370 | branchH->SetAddress(&hits); | |
371 | for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) { | |
372 | branchH->GetEntry(iTrack); | |
373 | ||
374 | //Get hits from the list | |
375 | for(Int_t ihit = 0; ihit< hits->GetEntries();ihit++){ | |
376 | ||
377 | hit = static_cast<AliEMCALHit *>(hits->At(ihit)) ; | |
c3e34498 | 378 | |
e44d51bd | 379 | if(hit != 0){ |
380 | if(fDebug>1) cout << "Hit info " << hit->GetId() << " " << hit->GetEnergy() << endl; | |
381 | ||
382 | Int_t id = hit->GetId(); | |
383 | // These are local coordinates | |
384 | Double_t xl = 0.; Double_t yl = 0.; Double_t zl = 0.; | |
385 | // Get global coordinates | |
386 | Double_t x = hit->X(); | |
387 | Double_t y = hit->Y(); | |
388 | Double_t z = hit->Z(); | |
389 | Double_t amp = hit->GetEnergy(); | |
390 | Int_t iSupMod = 0; | |
391 | // Get SM Id | |
392 | GetGeomInfo(id,iSupMod,xl,yl,zl); | |
393 | fSM[iSupMod]->RegisterHit(id,iSupMod,amp,x,y,z); | |
394 | }//hit exists | |
395 | }//hit loop | |
dd6d19d7 | 396 | hits->Clear(); |
e44d51bd | 397 | }// track loop |
398 | }//treeH exists | |
c3e34498 | 399 | } |
400 | ||
401 | //______________________________________________________________________________ | |
402 | void AliEveEMCALData::LoadDigits(TTree *t) | |
403 | { | |
404 | // | |
a312477b | 405 | // Get digit information from RunLoader |
c3e34498 | 406 | // |
407 | ||
408 | TClonesArray *digits = 0; | |
409 | t->SetBranchAddress("EMCAL", &digits); | |
410 | t->GetEntry(0); | |
411 | ||
412 | Int_t nEnt = digits->GetEntriesFast(); | |
413 | cout << "nEnt: " << nEnt << endl; | |
414 | AliEMCALDigit * dig; | |
415 | ||
a312477b | 416 | // Double_t amp = -1 ; |
ddc993e1 | 417 | Double_t ampFlo = -1 ; |
c3e34498 | 418 | Int_t id = -1 ; |
419 | Int_t iSupMod = 0 ; | |
420 | Double_t x, y, z; | |
421 | ||
422 | for (Int_t idig = 0; idig < nEnt; idig++) | |
423 | { | |
424 | dig = static_cast<AliEMCALDigit *>(digits->At(idig)); | |
425 | ||
426 | if(dig != 0) { | |
427 | id = dig->GetId() ; //cell (digit) label | |
a312477b | 428 | // adc |
ddc993e1 | 429 | ampFlo = dig->GetAmplitude(); //amplitude in cell (digit) |
a312477b | 430 | // GeV |
ddc993e1 | 431 | // amp = ampFlo*0.0153; // To be modified with correct OCDB conversion |
a312477b | 432 | |
c3e34498 | 433 | GetGeomInfo(id,iSupMod,x,y,z); |
434 | ||
a312477b | 435 | // // GeV |
436 | // fSM[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
437 | // // fSM[iSupMod]->SaveDigit(dig); | |
438 | // // if(iSupMod<fNsmfull) fSMfull[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
439 | // // if(iSupMod>fNsmfull) fSMhalf[iSupMod-10]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
ddc993e1 | 440 | fSM[iSupMod]->RegisterDigit(id,iSupMod,ampFlo,x,y,z); |
c3e34498 | 441 | // fSM[iSupMod]->SaveDigit(dig); |
442 | // if(iSupMod<fNsmfull) fSMfull[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
443 | // if(iSupMod>fNsmfull) fSMhalf[iSupMod-10]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
444 | } | |
445 | else { | |
446 | cout << "Digit object empty" << endl; | |
447 | return; | |
448 | } | |
449 | } // end loop digits | |
450 | cout << "after loop on digits !" << endl; | |
451 | } | |
452 | ||
453 | //______________________________________________________________________________ | |
345a46b0 | 454 | void AliEveEMCALData::LoadDigitsFromEMCALLoader(AliEMCALLoader* const emcl) |
c3e34498 | 455 | { |
456 | ||
457 | // | |
a312477b | 458 | // Get digit information from EMCAL Loader |
c3e34498 | 459 | // |
460 | ||
461 | AliEMCALDigit* dig; | |
462 | ||
463 | //Fill array of digits | |
464 | TClonesArray *digits = (TClonesArray*)emcl->Digits(); | |
465 | ||
466 | //Get digits from the list | |
467 | ||
a312477b | 468 | // Double_t amp = -1 ; |
ddc993e1 | 469 | Double_t ampFlo = -1 ; |
c3e34498 | 470 | Int_t id = -1 ; |
471 | Int_t iSupMod = 0 ; | |
472 | Double_t x, y, z; | |
473 | ||
474 | for(Int_t idig = 0; idig< digits->GetEntries();idig++){ | |
475 | ||
476 | dig = static_cast<AliEMCALDigit *>(digits->At(idig)) ; | |
477 | ||
478 | if(dig != 0){ | |
e44d51bd | 479 | if(fDebug>1) cout << "Digit info " << dig->GetId() << " " << dig->GetAmplitude() << endl; |
c3e34498 | 480 | id = dig->GetId() ; //cell (digit) label |
a312477b | 481 | // adc |
ddc993e1 | 482 | ampFlo = dig->GetAmplitude(); //amplitude in cell (digit) |
a312477b | 483 | // GeV |
ddc993e1 | 484 | // amp = ampFlo*0.0153.; // To be modified with correct OCDB conversion |
a312477b | 485 | |
c3e34498 | 486 | GetGeomInfo(id,iSupMod,x,y,z); |
487 | ||
a312477b | 488 | // // GeV |
489 | // fSM[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
490 | // adc | |
ddc993e1 | 491 | fSM[iSupMod]->RegisterDigit(id,iSupMod,ampFlo,x,y,z); |
c3e34498 | 492 | } |
493 | else { | |
494 | cout << "Digit object empty" << endl; | |
495 | return; | |
496 | } | |
497 | } // end loop on digits | |
498 | ||
499 | } | |
500 | ||
501 | //______________________________________________________________________________ | |
502 | void AliEveEMCALData::LoadDigitsFromESD() | |
503 | { | |
504 | // | |
505 | // Get digit information from esd | |
506 | // | |
507 | ||
508 | AliESDCaloCells &cells= *(fESD->GetEMCALCells()); | |
509 | Int_t ncell = cells.GetNumberOfCells() ; | |
c3e34498 | 510 | Int_t iSupMod = 0 ; |
511 | Double_t x, y, z; | |
512 | ||
513 | // Extract digit information from the ESDs | |
514 | for (Int_t icell= 0; icell < ncell; icell++) | |
515 | { | |
516 | Int_t id = cells.GetCellNumber(icell); | |
a312477b | 517 | // adc |
ddc993e1 | 518 | Double_t ampFlo = cells.GetAmplitude(icell); |
a312477b | 519 | // GeV |
ddc993e1 | 520 | // Double_t amp = ampFlo*0.0153; // To be modified with correct OCDB conversion |
c3e34498 | 521 | |
522 | GetGeomInfo(id,iSupMod,x,y,z); | |
523 | ||
a312477b | 524 | // // GeV |
525 | // fSM[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
526 | // if(iSupMod<fNsmfull) fSMfull[iSupMod]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
527 | // if(iSupMod>fNsmfull) fSMhalf[iSupMod-10]->RegisterDigit(id,iSupMod,amp,x,y,z); | |
528 | // adc | |
ddc993e1 | 529 | fSM[iSupMod]->RegisterDigit(id,iSupMod,ampFlo,x,y,z); |
530 | if(iSupMod<fNsmfull) fSMfull[iSupMod]->RegisterDigit(id,iSupMod,ampFlo,x,y,z); | |
531 | if(iSupMod>fNsmfull) fSMhalf[iSupMod-10]->RegisterDigit(id,iSupMod,ampFlo,x,y,z); | |
c3e34498 | 532 | |
533 | } // end loop cells | |
534 | } | |
535 | ||
536 | //______________________________________________________________________________ | |
345a46b0 | 537 | void AliEveEMCALData::LoadRecPoints(TTree* const t) |
c3e34498 | 538 | { |
a312477b | 539 | // |
540 | // Get rec point information from RunLoader | |
541 | // | |
542 | ||
c3e34498 | 543 | //************************************************* |
544 | // To be improved !!!!! | |
545 | // Size and shape of cluster to be implemented | |
546 | // | |
547 | //************************************************* | |
548 | ||
549 | // From TTreeR | |
550 | TObjArray *carr=NULL; | |
551 | TBranch *cbranch=t->GetBranch("EMCALECARP"); | |
552 | cbranch->SetAddress(&carr); | |
553 | ||
554 | if(cbranch->GetEvent(0)) { | |
555 | for(Int_t ic = 0; ic < carr->GetEntriesFast(); ic++) { | |
556 | AliEMCALRecPoint* rp =(AliEMCALRecPoint*)carr->UncheckedAt(ic); | |
557 | if(rp){ | |
a312477b | 558 | if(fDebug>1) cout << "RecPoint info " << rp->GetAbsId() << " " << rp->GetEnergy() << endl; |
c3e34498 | 559 | Int_t iSupMod = rp->GetSuperModuleNumber(); |
a312477b | 560 | // GeV |
561 | Double_t amp = (Double_t)rp->GetEnergy(); | |
562 | // adc | |
ddc993e1 | 563 | Double_t ampFlo = amp/0.0153; // To be modified with correct OCDB conversion |
c3e34498 | 564 | TVector3 lpos; |
565 | rp->GetLocalPosition(lpos); | |
566 | ||
a312477b | 567 | // // GeV |
568 | // fSM[iSupMod]->RegisterCluster(iSupMod,amp,lpos[0],lpos[1],lpos[2]); | |
569 | // adc | |
ddc993e1 | 570 | fSM[iSupMod]->RegisterCluster(iSupMod,ampFlo,lpos[0],lpos[1],lpos[2]); |
c3e34498 | 571 | } |
572 | } | |
573 | } | |
574 | ||
575 | } | |
576 | ||
577 | //______________________________________________________________________________ | |
345a46b0 | 578 | void AliEveEMCALData::LoadRecPointsFromEMCALLoader(AliEMCALLoader* const emcl) |
c3e34498 | 579 | { |
a312477b | 580 | // |
581 | // Get rec point information from EMCAL Loader | |
582 | // | |
583 | ||
c3e34498 | 584 | //************************************************* |
585 | // To be improved !!!!! | |
586 | // Size and shape of cluster to be implemented | |
587 | // | |
588 | //************************************************* | |
589 | ||
590 | // From EMCALLoader | |
591 | AliEMCALRecPoint* rp; | |
592 | ||
593 | //Fill array of clusters | |
594 | TClonesArray *clusters = (TClonesArray*)emcl->RecPoints(); | |
595 | ||
596 | //Get clusters from the list | |
597 | for(Int_t iclu = 0; iclu< clusters->GetEntries();iclu++){ | |
598 | ||
599 | rp = static_cast<AliEMCALRecPoint *>(clusters->At(iclu)) ; | |
600 | ||
601 | if(rp){ | |
a312477b | 602 | if(fDebug>1) cout << "RecPoint info " << rp->GetAbsId() << " " << rp->GetEnergy() << endl; |
c3e34498 | 603 | Int_t iSupMod = rp->GetSuperModuleNumber(); |
a312477b | 604 | Double_t amp = (Double_t)rp->GetEnergy(); |
ddc993e1 | 605 | Double_t ampFlo = amp/0.0153; // To be modified with correct OCDB conversion |
c3e34498 | 606 | TVector3 lpos; |
607 | rp->GetLocalPosition(lpos); | |
608 | ||
a312477b | 609 | // // GeV |
610 | // fSM[iSupMod]->RegisterCluster(iSupMod,amp,lpos[0],lpos[1],lpos[2]); | |
611 | // adc | |
ddc993e1 | 612 | fSM[iSupMod]->RegisterCluster(iSupMod,ampFlo,lpos[0],lpos[1],lpos[2]); |
c3e34498 | 613 | } |
614 | } | |
615 | ||
616 | } | |
617 | ||
618 | //______________________________________________________________________________ | |
619 | void AliEveEMCALData::LoadRecPointsFromESD() | |
620 | { | |
a312477b | 621 | // |
622 | // Get cluster information from esd | |
623 | // | |
624 | ||
625 | Int_t iSupMod = 0 ; | |
c3e34498 | 626 | Double_t x, y, z; |
627 | Int_t iSM = 0 ; | |
628 | Int_t iT = 0 ; | |
629 | Int_t iIp = 0 ; | |
630 | Int_t iIe = 0 ; | |
c3e34498 | 631 | Double_t xd, yd, zd; |
632 | Float_t pos[3] ; | |
633 | ||
634 | // Get reconstructed vertex position | |
635 | AliESDVertex* primVertex =(AliESDVertex*) fESD->GetVertex(); | |
345a46b0 | 636 | Double_t vertexPosition[3] ; |
637 | primVertex->GetXYZ(vertexPosition) ; | |
c3e34498 | 638 | |
639 | //Get the CaloClusters | |
640 | //select EMCAL clusters only | |
641 | TRefArray * caloClusters = new TRefArray(); | |
642 | fESD->GetEMCALClusters(caloClusters); | |
643 | Int_t nclus = caloClusters->GetEntries(); | |
644 | cout << "nclus: " << nclus << endl; | |
645 | ||
c3e34498 | 646 | for (Int_t iclus = 0; iclus < nclus; iclus++) |
647 | { | |
648 | AliESDCaloCluster *clus = (AliESDCaloCluster *) caloClusters->At(iclus) ; | |
649 | //Get the cluster info | |
650 | ||
a312477b | 651 | Double_t energy = clus->E() ; |
652 | // adc | |
653 | // Int_t eneInt = (Int_t)energy*500+0.5; | |
654 | Double_t eneInt = energy/0.0153; // To be modified with correct OCDB conversion | |
c8fe2783 | 655 | Double_t disp = clus->GetDispersion() ; |
c3e34498 | 656 | |
657 | clus->GetPosition(pos) ; // Global position | |
658 | TVector3 vpos(pos[0],pos[1],pos[2]) ; | |
659 | TLorentzVector p4 ; | |
660 | TVector3 p3; | |
345a46b0 | 661 | clus->GetMomentum(p4,vertexPosition); |
c3e34498 | 662 | p3.SetXYZ(p4[0],p4[1],p4[2]); |
a312477b | 663 | Double_t eta = p3.Eta(); |
664 | Double_t phi = ( (p3.Phi()) < 0) ? (p3.Phi()) + 2. * TMath::Pi() : (p3.Phi()); | |
c3e34498 | 665 | |
666 | Int_t mult = clus->GetNCells() ; | |
a312477b | 667 | if(fDebug>2) { |
668 | cout << "In cluster: " << iclus << ", ncells: " << mult << ", energy : " << energy << | |
669 | ", disp: " << disp << endl; | |
c3e34498 | 670 | cout << "Cluster " << iclus << ", eta: " << eta << ", phi: " << phi << endl; |
671 | } | |
672 | ||
673 | Int_t clusId = 0; | |
674 | fGeom->GetAbsCellIdFromEtaPhi(eta,phi,clusId); | |
a312477b | 675 | if(fDebug>2) { |
c3e34498 | 676 | cout << "Abs Cluster Id: " << clusId << ", xc: " << pos[0] << |
677 | ", yc: " << pos[1] << ", zc: " << pos[2] << endl; | |
678 | } | |
679 | ||
680 | GetGeomInfo(clusId,iSupMod,x,y,z); | |
681 | ||
682 | //******** Not used yet but will come ******** | |
a312477b | 683 | // AliESDCaloCells &cells= *(fESD->GetEMCALCells()); |
c3e34498 | 684 | Int_t digMult = clus->GetNCells() ; |
685 | UShort_t *digID = clus->GetCellsAbsId() ; | |
686 | for(Int_t i=0; i<digMult; i++){ | |
a312477b | 687 | // Float_t digitAmp = cells.GetCellAmplitude(digID[i]) ; |
c3e34498 | 688 | fGeom->RelPosCellInSModule(digID[i], xd, yd, zd); |
689 | //Geometry methods | |
690 | fGeom->GetCellIndex(digID[i],iSM,iT,iIp,iIe); | |
691 | //Gives SuperModule and Tower numbers | |
692 | ||
693 | } // end digit loop | |
694 | //********************************************* | |
a312477b | 695 | // // GeV |
696 | // fSM[iSupMod]->RegisterCluster(iSM,energy,x,y,z); | |
697 | // adc | |
698 | fSM[iSupMod]->RegisterCluster(iSM,eneInt,x,y,z); | |
c3e34498 | 699 | |
700 | } // end cluster loop | |
701 | } | |
702 | ||
703 | //______________________________________________________________________________ | |
704 | AliEveEMCALSModuleData* AliEveEMCALData::GetSModuleData(Int_t sm) | |
705 | { | |
706 | // | |
a312477b | 707 | // Return super module data |
c3e34498 | 708 | // |
709 | ||
710 | if (sm < 0 || sm > fNsm) | |
711 | { | |
712 | printf("The number of super modules must be lower or equal to %d",fNsm); | |
713 | return 0; | |
714 | } | |
715 | ||
716 | return fSM[sm]; | |
717 | } | |
718 | ||
719 | //______________________________________________________________________________ | |
345a46b0 | 720 | void AliEveEMCALData::LoadRaw() const |
c3e34498 | 721 | { |
a312477b | 722 | // |
723 | // Get raw information | |
724 | // | |
c3e34498 | 725 | |
a312477b | 726 | // To be implemented ! |
c3e34498 | 727 | } |
728 |