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