1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //_________________________________________________________________________
21 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
22 //////////////////////////////////////////////////////////////////////////////
25 // --- ROOT system ---
30 #include "TObjString.h"
32 // --- Standard library ---
35 // --- AliRoot header files ---
38 #include "AliPHOSIndexToObject.h"
39 #include "AliPHOSDigitizer.h"
40 #include "AliPHOSClusterizer.h"
41 #include "AliPHOSTrackSegmentMaker.h"
42 #include "AliPHOSPID.h"
44 ClassImp(AliPHOSIndexToObject)
46 AliPHOSIndexToObject * AliPHOSIndexToObject::fgObjGetter = 0 ;
48 //____________________________________________________________________________
49 AliPHOSIndexToObject::AliPHOSIndexToObject(char* headerFile,char* branch,char* branchTitle )
54 fDigits = new TClonesArray("AliPHOSDigit",100) ;
55 fEmcRecPoints = new TObjArray(100) ;
56 fCpvRecPoints = new TObjArray(100) ;
57 fTS = new TClonesArray("AliPHOSTrackSegment",100) ;
58 fRecParticles = new TClonesArray("AliPHOSRecParticle",100) ;
59 fPrimaries = new TObjArray(1) ;
67 fHeaderFile = headerFile ;
68 TFile * file = (TFile*) gROOT->GetFile(fHeaderFile.Data() ) ;
71 file = new TFile(fHeaderFile.Data(),"update") ;
72 gAlice = (AliRun *) file->Get("gAlice") ;
75 fMaxEvent = (Int_t) gAlice->TreeE()->GetEntries() ;
77 char * dummyfile = 0 ;
79 gAlice->GetEvent(fEvent) ;
81 Bool_t isRead = kFALSE;
83 if((strcmp(branch,"PHOSRP")==0) || (strcmp(branch,"PHOSPID")==0)){
84 ReadRecParticles(branchTitle) ; //first read RecPartcles and branche TS from which they are made
85 ReadTS(dummyfile); //read TS from which made RecParticles above
86 ReadRecPoints(dummyfile) ; //RecPoints from which TS above made
87 ReadDigits(dummyfile) ; //digits. from whic RecPoints made
91 if((strcmp(branch,"PHOSTS")==0) || (strcmp(branch,"PHOSTSMaker")==0)){
92 ReadTS(branchTitle); //read TS and branch of RecPoints from which they are made
93 ReadRecPoints(dummyfile) ; //recpoints abd branch of digits
94 ReadDigits(dummyfile) ; //digits and branch of Primaries
95 ReadRecParticles(dummyfile) ; //posiible completion of TS
99 if((strcmp(branch,"PHOSEmcRP")==0)|| (strcmp(branch,"PHOSCpvRP")==0) ||
100 (strcmp(branch,"PHOSClusterizer")==0)){
101 ReadRecPoints(branchTitle) ; //RecPoints and Digits branch filename
102 ReadDigits(dummyfile) ; //digits and primary file name
103 ReadTS(dummyfile); //possible completion of RecPoints
104 ReadRecParticles(dummyfile) ; //possible completion of TS
108 if((strcmp(branch,"PHOS")==0) || (strcmp(branch,"PHOSDigitizer")==0)){
109 ReadDigits(branchTitle) ;
110 ReadRecPoints(dummyfile) ;
112 ReadRecParticles(dummyfile) ;
117 cout << "AliPHOSIndexToObject: wrong branch name specified: " << branch << endl ;
118 cout << " avalilable names are `PHOSRP', `PHOSPID'"<<endl ;
119 cout << " `PHOSTS', `PHOSTSMaker'"<<endl ;
120 cout << " `PHOSEmcRP', `PHOSCpvRP', `PHOSClusterizer'"<< endl ;
121 cout << " `PHOS' and `PHOSDigitizer'"<< endl ;
123 ReadPrimaries() ; // should be called when digits are already read
126 //____________________________________________________________________________
127 AliPHOSIndexToObject * AliPHOSIndexToObject::GetInstance()
129 // Returns the pointer of the unique instance already defined
131 AliPHOSIndexToObject * rv = 0 ;
135 cout << "AliPHOSIndexToObject::GetInstance ERROR: not yet initialized" << endl ;
140 //____________________________________________________________________________
141 AliPHOSIndexToObject * AliPHOSIndexToObject::GetInstance(char* headerFile,char* branch,char* branchTitle)
143 // Creates and returns the pointer of the unique instance
144 // Must be called only when the environment has changed
146 if ( fgObjGetter ) // delete it if already exists
149 fgObjGetter = new AliPHOSIndexToObject(headerFile,branch,branchTitle) ;
155 //____________________________________________________________________________
156 TParticle * AliPHOSIndexToObject::GimePrimary(Int_t index)
160 Int_t primaryList = (Int_t) (TMath::Ceil(index/10000000.) ) - 1 ;
161 Int_t primaryIndex = index - primaryList*10000000 ;
163 if ( primaryList > 0 ) {
164 cout << " IndexToObject does not support currently Mixing of primary " << endl ;
165 cout << " can not return primary: " << index<< " (list "<< primaryList<< " primary # " << primaryIndex << " )"<<endl ;
169 return gAlice->Particle(primaryIndex) ;
173 //____________________________________________________________________________
174 Bool_t AliPHOSIndexToObject::ReadRecParticles(char * branchTitle){
176 if(gAlice->TreeR()==0)
179 if(fPID) // already read
180 branchTitle = fPID->GetRecParticlesBranch() ;
183 if(branchTitle){ // we should read a specific branch
184 TBranch * pidBranch = 0;
185 TBranch * rpBranch = 0;
187 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
189 Bool_t pidNotFound = kTRUE ;
190 Bool_t rpNotFound = kTRUE ;
192 for(ibranch = 0;(ibranch <branches->GetEntries())&&(pidNotFound||rpNotFound);ibranch++){
195 pidBranch=(TBranch *) branches->At(ibranch) ;
196 if( (strcmp(branchTitle,pidBranch->GetTitle())==0 ) &&
197 (strcmp(pidBranch->GetName(),"AliPHOSPID") == 0) )
198 pidNotFound = kFALSE ;
201 rpBranch=(TBranch *) branches->At(ibranch) ;
202 if( (strcmp(branchTitle,rpBranch->GetTitle())==0 ) &&
203 (strcmp(rpBranch->GetName(),"PHOSRP") == 0) )
204 rpNotFound = kFALSE ;
208 if(pidNotFound ||rpNotFound ){
209 cout << "AliPHOSIndexToObject error" << endl ;
210 cout << " Can't find Branch with PID and RecParticles " ;
214 pidBranch->SetAddress(&fPID) ;
215 rpBranch->SetAddress(&fRecParticles) ;
216 gAlice->TreeR()->GetEvent(0) ;
218 else{ //we Should read any branch and print warning if there are other possibilities
219 if(fTSMaker){//if TrackSegments already read, we should read RecParticles Made from it
220 TBranch * pidBranch = 0;
221 TBranch * rpBranch = 0;
223 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
225 Int_t branchRead = 0;
226 Bool_t allNotFound = kTRUE ;
228 Bool_t pidNotFound = kTRUE ;
229 Bool_t rpNotFound = kTRUE ;
231 for(ibranch = branchRead;(ibranch <branches->GetEntries() )&& pidNotFound;ibranch++){
232 pidBranch=(TBranch *) branches->At(ibranch) ;
233 if(strcmp(pidBranch->GetName(),"AliPHOSPID") == 0)
234 pidNotFound = kFALSE ;
236 branchRead = ibranch +1 ;
237 for(ibranch = 0 ;(ibranch <branches->GetEntries() )&& rpNotFound;ibranch++){
238 rpBranch=(TBranch *) branches->At(ibranch) ;
239 if( (strcmp(pidBranch->GetTitle(),rpBranch->GetTitle())==0 ) &&
240 (strcmp(rpBranch->GetName(),"PHOSRP") == 0) )
241 rpNotFound = kFALSE ;
244 if(pidNotFound ||rpNotFound ){
245 cout << "AliPHOSIndexToObject error" << endl ;
246 cout << " Can't find Branch with PID and RecParticles " ;
250 pidBranch->SetAddress(&fPID) ;
251 rpBranch->SetAddress(&fRecParticles) ;
252 gAlice->TreeR()->GetEvent(0) ;
254 if(strcmp(fTSMaker->GetTrackSegmentsBranch(),fPID->GetTrackSegmentsBranch()) == 0)
255 allNotFound = kFALSE ;
258 else{//we read any (first) recparticles
259 TBranch * pidBranch = 0;
260 TBranch * rpBranch = 0;
261 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
263 Bool_t pidNotFound = kTRUE ;
264 Bool_t rpNotFound = kTRUE ;
266 for(ibranch = 0;(ibranch <branches->GetEntries() )&& pidNotFound;ibranch++){
267 pidBranch=(TBranch *) branches->At(ibranch) ;
268 if(strcmp(pidBranch->GetName(),"AliPHOSPID") == 0)
269 pidNotFound = kFALSE ;
271 for(ibranch = 0 ;(ibranch <branches->GetEntries() )&& rpNotFound;ibranch++){
272 rpBranch=(TBranch *) branches->At(ibranch) ;
273 if( (strcmp(pidBranch->GetTitle(),rpBranch->GetTitle())==0 ) &&
274 (strcmp(rpBranch->GetName(),"PHOSRP") == 0) )
275 rpNotFound = kFALSE ;
278 if(pidNotFound ||rpNotFound ){
279 cout << "AliPHOSIndexToObject worning: " << endl ;
280 cout << " Can't find Branch with PID and RecParticles " << endl;
284 pidBranch->SetAddress(&fPID) ;
285 rpBranch->SetAddress(&fRecParticles) ;
286 gAlice->TreeR()->GetEvent(0) ;
292 //____________________________________________________________________________
293 Bool_t AliPHOSIndexToObject::ReadTS(char * branchTitle){
295 if(gAlice->TreeR()==0)
298 if(fPID)//if RecParticles already read, we should read TS from which they are made
299 branchTitle= fPID->GetTrackSegmentsBranch() ;
301 if(branchTitle){ // we should read a specific branch
303 TBranch * tsMakerBranch = 0;
304 TBranch * tsBranch = 0;
306 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
308 Bool_t tsMakerNotFound = kTRUE ;
309 Bool_t tsNotFound = kTRUE ;
311 for(ibranch = 0;(ibranch <branches->GetEntries())&&(tsMakerNotFound||tsNotFound);ibranch++){
313 tsMakerBranch=(TBranch *) branches->At(ibranch) ;
314 if( strcmp(branchTitle,tsMakerBranch->GetTitle())==0 )
315 if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
316 tsMakerNotFound = kFALSE ;
319 tsBranch=(TBranch *) branches->At(ibranch) ;
320 if( strcmp(branchTitle,tsBranch->GetTitle())==0 )
321 if( strcmp(tsBranch->GetName(),"PHOSTS") == 0)
322 tsNotFound = kFALSE ;
326 if(tsMakerNotFound ||tsNotFound ){
327 cout << "AliPHOSIndexToObject error" << endl ;
328 cout << " Can't find Branch with TrackSegmentMaker and TrackSegments " ;
329 cout << " Do nothing" <<endl ;
333 tsMakerBranch->SetAddress(&fTSMaker) ;
334 tsBranch->SetAddress(&fTS) ;
335 gAlice->TreeR()->GetEvent(0) ;
339 if(fClusterizer){//Clusterizer aready read,
340 //we should read TrackSegments made from these RecPoints
342 Int_t branchRead = 0 ;
343 TBranch * tsMakerBranch = 0;
344 TBranch * tsBranch = 0;
346 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
348 Bool_t allNotFound = kTRUE ;
350 Bool_t tsMakerNotFound = kTRUE ;
351 Bool_t tsNotFound = kTRUE ;
353 for(ibranch = branchRead;(ibranch <branches->GetEntries())&&(tsMakerNotFound);ibranch++){
354 tsMakerBranch=(TBranch *) branches->At(ibranch) ;
355 if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
356 tsMakerNotFound = kFALSE ;
358 branchRead = ibranch++ ;
359 for(ibranch = 0 ;(ibranch <branches->GetEntries())&&(tsNotFound);ibranch++){
360 tsBranch=(TBranch *) branches->At(ibranch) ;
361 if( (strcmp(tsBranch->GetName(),"PHOSTS") == 0) &&
362 (strcmp(tsBranch->GetName(),tsMakerBranch->GetTitle())==0))
363 tsNotFound = kFALSE ;
366 branchRead = ibranch++ ;
368 if(tsMakerNotFound ||tsNotFound ){
369 cout << "AliPHOSIndexToObject error" << endl ;
370 cout << " Can't find Branch with TrackSegmentMaker and TrackSegments " ;
371 cout << " Do nothing" <<endl ;
375 tsMakerBranch->SetAddress(&fTSMaker) ;
376 tsBranch->SetAddress(&fTS) ;
377 gAlice->TreeR()->GetEvent(0) ;
379 if(strcmp(fTSMaker->GetRecPointsBranch(),fClusterizer->GetRecPointsBranch()) == 0)
380 allNotFound = kFALSE ;
384 else{//Neither Title,neither fPID, neither fClusterizer: we read any (first) occurence
385 TBranch * tsMakerBranch = 0;
386 TBranch * tsBranch = 0;
387 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
388 Bool_t tsMakerNotFound = kTRUE ;
389 Bool_t tsNotFound = kTRUE ;
391 for(ibranch = 0;(ibranch <branches->GetEntries())&& tsMakerNotFound;ibranch++){
392 tsMakerBranch=(TBranch *) branches->At(ibranch) ;
393 if( strcmp(tsMakerBranch->GetName(),"AliPHOSTrackSegmentMaker") == 0)
394 tsMakerNotFound = kFALSE ;
396 for(ibranch = 0 ;(ibranch <branches->GetEntries())&&(tsNotFound);ibranch++){
397 tsBranch=(TBranch *) branches->At(ibranch) ;
398 if( (strcmp(tsBranch->GetName(),"PHOSTS") == 0) &&
399 (strcmp(tsBranch->GetName(),tsMakerBranch->GetTitle())==0))
400 tsNotFound = kFALSE ;
402 if(tsMakerNotFound ||tsNotFound ){
403 cout << "AliPHOSIndexToObject error" << endl ;
404 cout << " Can't find Branch with TrackSegmentMaker and TrackSegments " ;
405 cout << " Do nothing" <<endl ;
409 tsMakerBranch->SetAddress(&fTSMaker) ;
410 tsBranch->SetAddress(&fTS) ;
411 gAlice->TreeR()->GetEvent(0) ;
417 //____________________________________________________________________________
418 Bool_t AliPHOSIndexToObject::ReadRecPoints(char * branchTitle){
420 if(gAlice->TreeR() == 0)
423 if(fTSMaker) //if TrackSegment maker already read, read corresponding branches
424 branchTitle = fTSMaker->GetRecPointsBranch() ;
426 if(branchTitle){ // we should read a specific branch
427 TBranch * emcBranch = 0;
428 TBranch * cpvBranch = 0;
429 TBranch * clusterizerBranch = 0;
431 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
433 Bool_t emcNotFound = kTRUE ;
434 Bool_t cpvNotFound = kTRUE ;
435 Bool_t clusterizerNotFound = kTRUE ;
437 for(ibranch = 0;((ibranch < branches->GetEntries())&&(emcNotFound ||cpvNotFound || clusterizerNotFound)) ;ibranch++){
439 emcBranch=(TBranch *) branches->At(ibranch) ;
440 if( (strcmp(emcBranch->GetTitle(),branchTitle) == 0) &&
441 (strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0) )
442 emcNotFound = kFALSE ;
445 cpvBranch=(TBranch *) branches->At(ibranch) ;
446 if( (strcmp(cpvBranch->GetTitle(),branchTitle) == 0) &&
447 (strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0) )
448 cpvNotFound = kFALSE ;
450 if(clusterizerNotFound){
451 clusterizerBranch = (TBranch *) branches->At(ibranch) ;
452 if( (strcmp(clusterizerBranch->GetTitle(),branchTitle) == 0) &&
453 (strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0) )
454 clusterizerNotFound = kFALSE ;
459 if(clusterizerNotFound || emcNotFound || cpvNotFound){
460 cout << "AliPHOSIndexToObject error" << endl ;
461 cout << " Can't find Branch with RecPoints or Clusterizer " << endl ;
465 emcBranch->SetAddress(&fEmcRecPoints) ;
466 cpvBranch->SetAddress(&fCpvRecPoints) ;
467 clusterizerBranch->SetAddress(&fClusterizer) ;
468 gAlice->TreeR()->GetEvent(0) ;
470 else{ //no specific branch
471 if(fDigitizer){//Digitizer aready read,
472 //we should read RecPoints made from these Digits
473 TBranch * emcBranch = 0;
474 TBranch * cpvBranch = 0;
475 TBranch * clusterizerBranch = 0;
477 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
478 Int_t branchRead = 0;
479 Bool_t allNotFound = kTRUE ;
481 Bool_t emcNotFound = kTRUE ;
482 Bool_t cpvNotFound = kTRUE ;
483 Bool_t clusterizerNotFound = kTRUE ;
485 for(ibranch = branchRead;ibranch < branches->GetEntries();ibranch++){
486 emcBranch=(TBranch *) branches->At(ibranch) ;
487 if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0)
488 emcNotFound = kFALSE ;
490 branchRead = ibranch + 1 ;
491 for(ibranch = 0 ;ibranch < branches->GetEntries();ibranch++){
492 cpvBranch=(TBranch *) branches->At(ibranch) ;
493 if( (strcmp(cpvBranch->GetTitle(),emcBranch->GetTitle()) == 0) &&
494 (strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0) )
495 cpvNotFound = kFALSE ;
497 for(ibranch = 0 ;ibranch < branches->GetEntries();ibranch++){
498 clusterizerBranch = (TBranch *) branches->At(ibranch) ;
499 if( (strcmp(clusterizerBranch->GetTitle(),emcBranch->GetTitle()) == 0) &&
500 (strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0) )
501 clusterizerNotFound = kFALSE ;
504 if(clusterizerNotFound || emcNotFound || cpvNotFound){
505 cout << "AliPHOSIndexToObject error" << endl ;
506 cout << " Can't find Branch with RecPoints or Clusterizer " << endl ;
510 emcBranch->SetAddress(&fEmcRecPoints) ;
511 cpvBranch->SetAddress(&fCpvRecPoints) ;
512 clusterizerBranch->SetAddress(&fClusterizer) ;
513 gAlice->TreeR()->GetEvent(0) ;
515 if(strcmp(fClusterizer->GetDigitsBranch(),fDigitizer->GetDigitsBranch())== 0)
516 allNotFound = kFALSE ;
519 else{//Neither Title, Neither TSMaker, Neither Digits: we read any (first) RecPoints
520 TBranch * emcBranch = 0;
521 TBranch * cpvBranch = 0;
522 TBranch * clusterizerBranch = 0;
523 TObjArray * branches = gAlice->TreeR()->GetListOfBranches() ;
524 Bool_t emcNotFound = kTRUE ;
525 Bool_t cpvNotFound = kTRUE ;
526 Bool_t clusterizerNotFound = kTRUE ;
528 for(ibranch = 0 ;ibranch < branches->GetEntries();ibranch++){
529 emcBranch=(TBranch *) branches->At(ibranch) ;
530 if( strcmp(emcBranch->GetName(),"PHOSEmcRP") == 0)
531 emcNotFound = kFALSE ;
533 for(ibranch = 0 ;ibranch < branches->GetEntries();ibranch++){
534 cpvBranch=(TBranch *) branches->At(ibranch) ;
535 if( (strcmp(cpvBranch->GetTitle(),emcBranch->GetTitle()) == 0) &&
536 (strcmp(cpvBranch->GetName(),"PHOSCpvRP") == 0) )
537 cpvNotFound = kFALSE ;
539 for(ibranch = 0;ibranch < branches->GetEntries();ibranch++){
540 clusterizerBranch = (TBranch *) branches->At(ibranch) ;
541 if( (strcmp(clusterizerBranch->GetTitle(),emcBranch->GetTitle()) == 0) &&
542 (strcmp(clusterizerBranch->GetName(),"AliPHOSClusterizer") == 0) )
543 clusterizerNotFound = kFALSE ;
546 if(clusterizerNotFound || emcNotFound || cpvNotFound){
547 cout << "AliPHOSIndexToObject error" << endl ;
548 cout << " Can't find Branch with RecPoints or Clusterizer " << endl ;
552 emcBranch->SetAddress(&fEmcRecPoints) ;
553 cpvBranch->SetAddress(&fCpvRecPoints) ;
554 clusterizerBranch->SetAddress(&fClusterizer) ;
555 gAlice->TreeR()->GetEvent(0) ;
561 //____________________________________________________________________________
562 Bool_t AliPHOSIndexToObject::ReadDigits(char * branchTitle){
564 if(gAlice->TreeD()== 0)
567 //if RecPoints are already read, we should read Digits from which they are made
569 branchTitle = fClusterizer->GetDigitsBranch() ;
571 if(branchTitle){ // we should read a specific branch
572 TBranch * digitsBranch = 0;
573 TBranch * digitizerBranch = 0;
575 TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ;
577 Bool_t phosNotFound = kTRUE ;
578 Bool_t digitizerNotFound = kTRUE ;
580 for(ibranch = 0;ibranch <branches->GetEntries();ibranch++){
583 digitsBranch=(TBranch *) branches->At(ibranch) ;
584 if( (strcmp(digitsBranch->GetTitle(),branchTitle)==0 ) &&
585 (strcmp(digitsBranch->GetName(),"PHOS") == 0) )
586 phosNotFound = kFALSE ;
588 if(digitizerNotFound){
589 digitizerBranch = (TBranch *) branches->At(ibranch) ;
590 if( (strcmp(digitizerBranch->GetTitle(),branchTitle) == 0) &&
591 (strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0) )
592 digitizerNotFound = kFALSE ;
596 if(digitizerNotFound || phosNotFound){
597 cout << "AliPHOSIndexToObject error: " << endl ;
598 cout << " Can't find Branch with Digits or Digitizer "<< endl ; ;
602 digitsBranch->SetAddress(&fDigits) ;
603 digitizerBranch->SetAddress(&fDigitizer) ;
605 gAlice->TreeD()->GetEvent(0) ;
607 else{ //we should read any branch and print warning if there are other possibilities
608 TBranch * digitsBranch = 0;
609 TBranch * digitizerBranch = 0;
611 TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ;
613 Bool_t phosNotFound = kTRUE ;
614 Bool_t digitizerNotFound = kTRUE ;
616 for(ibranch = 0;(ibranch <branches->GetEntries())&& phosNotFound ;ibranch++){
617 digitsBranch=(TBranch *) branches->At(ibranch) ;
618 if(strcmp(digitsBranch->GetName(),"PHOS") == 0)
619 phosNotFound = kFALSE ;
621 for(ibranch = 0;(ibranch <branches->GetEntries())&& digitizerNotFound ;ibranch++){
622 digitizerBranch = (TBranch *) branches->At(ibranch) ;
623 if( (strcmp(digitizerBranch->GetTitle(),digitsBranch->GetTitle()) == 0) &&
624 (strcmp(digitizerBranch->GetName(),"AliPHOSDigitizer") == 0) )
625 digitizerNotFound = kFALSE ;
628 if(digitizerNotFound || phosNotFound){
629 cout << "AliPHOSIndexToObject error: " << endl ;
630 cout << " Can't find Branch with Digits or Digitizer "<< endl ; ;
634 digitsBranch->SetAddress(&fDigits) ;
635 digitizerBranch->SetAddress(&fDigitizer) ;
637 gAlice->TreeD()->GetEvent(0) ;
643 //____________________________________________________________________________
644 Bool_t AliPHOSIndexToObject::ReadPrimaries(){
645 //read specific branches of primaries
647 // //Check, is it necessary to open new files
648 // TArrayI* events = fDigitizer->GetCurrentEvents() ;
649 // TClonesArray * filenames = fDigitizer->GetHeadersFiles() ;
651 // for(input = 0; input < filenames->GetEntriesFast(); input++){
653 // TObjString * filename = (TObjString *) filenames->At(input) ;
655 // //Test, if this file already open
656 // TFile *file = (TFile*) gROOT->GetFile( filename->GetString() ) ;
658 // file = new TFile( filename->GetString()) ;
661 // // Get Kine Tree from file
662 // // char treeName[20];
663 // // sprintf(treeName,"TreeK%d",events->At(input));
664 // // TTree * treeK = (TTree*)gDirectory->Get(treeName);
666 // // treeK->SetBranchAddress("Particles", &fParticleBuffer);
668 // // cout << "AliPHOSIndexToObject: cannot find Kine Tree for event:" << events->At(input) << endl;
670 // // // Create the particle stack
671 // // if(!fParticles) fParticles = new TClonesArray("TParticle",1000);
672 // // // Build the pointer list
673 // // if(fParticleMap) { <----
674 // // fParticleMap->Clear();
675 // // fParticleMap->Expand(treeK->GetEntries());
677 // // fParticleMap = new TObjArray(treeK->GetEntries());
679 // // From gAlice->Particle(i)
682 // // if(!(*fParticleMap)[i]) {
683 // // Int_t nentries = fParticles->GetEntries();
685 // // // algorithmic way of getting entry index
686 // // // (primary particles are filled after secondaries)
688 // // if (i<fHeader.GetNprimary())
689 // // entry = i+fHeader.GetNsecondary();
691 // // entry = i-fHeader.GetNprimary();
693 // // // only check the algorithmic way and give
694 // // // the fatal error if it is wrong
695 // // if (entry != fParticleFileMap[i]) {
696 // // Fatal("Particle",
697 // // "!!!! The algorithmic way is WRONG: !!!\n entry: %d map: %d",
698 // // entry, fParticleFileMap[i]);
701 // // fTreeK->GetEntry(fParticleFileMap[i]);
702 // // new ((*fParticles)[nentries]) TParticle(*fParticleBuffer);
703 // // fParticleMap->AddAt((*fParticles)[nentries],i);
705 // // return (TParticle *) (*fParticleMap)[i];
712 // //scan over opened files and read corresponding TreeK##
716 //____________________________________________________________________________
717 void AliPHOSIndexToObject::GetEvent(Int_t event){
718 if(event == fEvent) // do nothing
722 gAlice->GetEvent(fEvent) ;
724 ReadRecParticles(fPID->GetRecParticlesBranch()) ;
725 ReadTS(fTSMaker->GetTrackSegmentsBranch()) ;
726 ReadRecPoints(fClusterizer->GetRecPointsBranch()) ;
727 ReadDigits(fDigitizer->GetDigitsBranch()) ;