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