]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALGetter.cxx
removing EMCAL arm from geometry and and updating digitizer so we can store 200GeV...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGetter.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /* $Id$ */
17
18 //_________________________________________________________________________
19 //  A singleton. This class should be used in the analysis stage to get 
20 //  reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
21 //  instead of directly reading them from galice.root file. This container 
22 //  ensures, that one reads Digits, made of these particular digits, RecPoints, 
23 //  made of these particular RecPoints, TrackSegments and RecParticles. 
24 //  This becomes non trivial if there are several identical branches, produced with
25 //  different set of parameters. 
26 //
27 //  An example of how to use (see also class AliEMCALAnalyser):
28 //  AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
29 //  for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
30 //     AliEMCALRecParticle * part = gime->RecParticle(1) ;
31 //     ................
32 //  gime->Event(event) ;    // reads new event from galice.root
33 //                  
34 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
35 //*--         Completely redesigned by Dmitri Peressounko March 2001  
36 //
37 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
38 //*--         systematic usage of TFolders without changing the interface        
39 //////////////////////////////////////////////////////////////////////////////
40
41 // --- ROOT system ---
42
43 #include "TSystem.h"
44 #include "TROOT.h"
45
46
47 // --- Standard library ---
48
49 // --- AliRoot header files ---
50
51 #include "AliEMCALGetter.h"
52 #include "AliEMCAL.h"
53 #include "AliRunLoader.h"
54 #include "AliStack.h"  
55 #include "AliEMCALLoader.h"
56 #include "AliMC.h"
57
58 ClassImp(AliEMCALGetter)
59   
60 AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ; 
61 AliEMCALLoader * AliEMCALGetter::fgEmcalLoader = 0;
62 Int_t AliEMCALGetter::fgDebug = 0;
63
64 //  TFile * AliEMCALGetter::fgFile = 0 ; 
65
66 //____________________________________________________________________________ 
67 AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* version, Option_t * openingOption)
68 {
69   // ctor only called by Instance()
70
71   AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ; 
72   if (!rl) {
73     rl = AliRunLoader::Open(headerFile, version, openingOption);
74     if (!rl) {
75       Fatal("AliEMCALGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ; 
76       return ;
77     } 
78     if (rl->GetAliRun() == 0x0) {
79       rl->LoadgAlice();
80       gAlice = rl->GetAliRun(); // should be removed
81     }
82   }
83   fgEmcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetLoader("EMCALLoader"));
84   if ( !fgEmcalLoader ) 
85     Error("AliEMCALGetter", "Could not find EMCALLoader") ; 
86   else 
87     fgEmcalLoader->SetTitle(version);
88   
89   
90   // initialize data members
91   SetDebug(0) ; 
92   //fBTE = 0 ; 
93   fPrimaries = 0 ; 
94   fLoadingStatus = "" ; 
95 }
96
97 //____________________________________________________________________________ 
98 AliEMCALGetter::~AliEMCALGetter()
99 {
100   // dtor
101   delete fgEmcalLoader ;
102   fgEmcalLoader = 0 ;
103   //delete fBTE ; 
104   // fBTE = 0 ; 
105   fPrimaries->Delete() ; 
106   delete fPrimaries ; 
107 }
108
109 //____________________________________________________________________________ 
110 AliEMCALClusterizer * AliEMCALGetter::Clusterizer()
111
112   // return pointer to Clusterizer Tree
113   AliEMCALClusterizer * rv ; 
114   rv =  dynamic_cast<AliEMCALClusterizer *>(EmcalLoader()->Reconstructioner()) ;
115   if (!rv) {
116     Event(0, "R") ; 
117     rv =  dynamic_cast<AliEMCALClusterizer*>(EmcalLoader()->Reconstructioner()) ;
118   }
119   return rv ; 
120 }
121
122
123 //____________________________________________________________________________ 
124 TClonesArray * AliEMCALGetter::Digits() const  
125 {
126   // asks the Loader to return the Digits container 
127
128   TClonesArray * rv = 0 ; 
129   rv = EmcalLoader()->Digits() ; 
130
131   if( !rv ) {
132     EmcalLoader()->MakeDigitsArray() ; 
133     rv = EmcalLoader()->Digits() ;
134   }
135   return rv ; 
136 }
137
138 //____________________________________________________________________________ 
139 AliEMCALDigitizer * AliEMCALGetter::Digitizer() 
140
141   // return pointer to Digitizer Tree
142   AliEMCALDigitizer * rv ; 
143   rv =  dynamic_cast<AliEMCALDigitizer *>(EmcalLoader()->Digitizer()) ;
144   if (!rv) {
145     Event(0, "D") ; 
146     rv =  dynamic_cast<AliEMCALDigitizer *>(EmcalLoader()->Digitizer()) ;
147   }
148   return rv ; 
149 }
150
151 //____________________________________________________________________________ 
152 TObjArray * AliEMCALGetter::ECARecPoints() const 
153 {
154   // asks the Loader to return the EMC RecPoints container 
155
156   TObjArray * rv = 0 ; 
157   
158   rv = EmcalLoader()->ECARecPoints() ; 
159   if (!rv) {
160     EmcalLoader()->MakeRecPointsArray() ;
161     rv = EmcalLoader()->ECARecPoints() ; 
162   }
163   return rv ; 
164 }
165
166 //____________________________________________________________________________ 
167 TClonesArray * AliEMCALGetter::TrackSegments() const 
168 {
169   // asks the Loader to return the TrackSegments container 
170
171   TClonesArray * rv = 0 ; 
172   
173   rv = EmcalLoader()->TrackSegments() ; 
174   if (!rv) {
175     EmcalLoader()->MakeTrackSegmentsArray() ;
176     rv = EmcalLoader()->TrackSegments() ; 
177   }
178   return rv ; 
179 }
180
181 //____________________________________________________________________________ 
182 AliEMCALTrackSegmentMaker * AliEMCALGetter::TrackSegmentMaker() 
183
184   // return pointer to TrackSegmentMaker Tree
185   AliEMCALTrackSegmentMaker * rv ; 
186   rv =  dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
187   if (!rv) {
188     Event(0, "T") ; 
189     rv =  dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
190   }
191   return rv ; 
192 }
193
194 //____________________________________________________________________________ 
195 TClonesArray * AliEMCALGetter::RecParticles() const  
196 {
197   // asks the Loader to return the TrackSegments container 
198
199   TClonesArray * rv = 0 ; 
200   
201   rv = EmcalLoader()->RecParticles() ; 
202   if (!rv) {
203     EmcalLoader()->MakeRecParticlesArray() ;
204     rv = EmcalLoader()->RecParticles() ; 
205   }
206   return rv ; 
207 }
208 //____________________________________________________________________________ 
209 void AliEMCALGetter::Event(Int_t event, const char* opt) 
210 {
211   // Reads the content of all Tree's S, D and R
212
213   if ( event >= MaxEvent() ) {
214     Error("Event", "%d not found in TreeE !", event) ; 
215     return ; 
216   }
217
218   AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
219
220   // checks if we are dealing with test-beam data
221 //   TBranch * btb = rl->TreeE()->GetBranch("AliEMCALBeamTestEvent") ;
222 //   if(btb){
223 //     if(!fBTE)
224 //       fBTE = new AliEMCALBeamTestEvent() ;
225 //     btb->SetAddress(&fBTE) ;
226 //     btb->GetEntry(event) ;
227 //   }
228 //   else{
229 //     if(fBTE){
230 //       delete fBTE ;
231 //       fBTE = 0 ;
232 //     }
233 //   }
234
235   // Loads the type of object(s) requested
236   
237   rl->GetEvent(event) ;
238
239   if( strstr(opt,"X") || (strcmp(opt,"")==0) )
240     ReadPrimaries() ;
241
242   if(strstr(opt,"H") )
243     ReadTreeH();
244
245   if(strstr(opt,"S") )
246     ReadTreeS() ;
247
248   if( strstr(opt,"D") )
249     ReadTreeD() ;
250
251   if( strstr(opt,"R") )
252     ReadTreeR() ;
253
254   if( strstr(opt,"T") )
255     ReadTreeT() ;
256
257   if( strstr(opt,"P") )
258     ReadTreeP() ;
259  
260 }
261
262
263 //____________________________________________________________________________ 
264 Int_t AliEMCALGetter::EventNumber() const
265   {
266   // return the current event number
267   AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
268   return static_cast<Int_t>(rl->GetEventNumber()) ;   
269 }
270
271 //____________________________________________________________________________ 
272   TClonesArray * AliEMCALGetter::Hits() const   
273 {
274   // asks the loader to return  the Hits container 
275   
276   TClonesArray * rv = 0 ; 
277   
278   rv = EmcalLoader()->Hits() ; 
279   if ( !rv ) {
280     EmcalLoader()->LoadHits("read"); 
281     rv = EmcalLoader()->Hits() ; 
282   }
283   return rv ; 
284 }
285
286 //____________________________________________________________________________ 
287 AliEMCALGetter * AliEMCALGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption) 
288 {
289   // Creates and returns the pointer of the unique instance
290   // Must be called only when the environment has changed
291   
292   if(!fgObjGetter){ // first time the getter is called 
293     fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;
294   }
295   else { // the getter has been called previously
296     AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
297     if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name
298       // check if the file is already open
299       TFile * galiceFile = dynamic_cast<TFile *>(gROOT->FindObject(rl->GetFileName()) ) ; 
300       
301       if ( !galiceFile ) 
302         fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;
303       
304       else {  // the file is already open check the version name
305         TString currentVersionName = rl->GetEventFolder()->GetName() ; 
306         TString newVersionName(version) ; 
307         if (currentVersionName == newVersionName) 
308           if(fgDebug)
309             ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ;  
310         else {
311           fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;      
312         }
313       }
314     }
315     else 
316       fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;      
317   }
318   if (!fgObjGetter) 
319     ::Error("AliEMCALGetter::Instance", "Failed to create the EMCAL Getter object") ;
320   else 
321     if (fgDebug)
322       Print() ;
323   
324   return fgObjGetter ;
325 }
326
327 //____________________________________________________________________________ 
328 AliEMCALGetter *  AliEMCALGetter::Instance()
329 {
330   // Returns the pointer of the unique instance already defined
331   
332   if(!fgObjGetter && fgDebug)
333      ::Warning("AliEMCALGetter::Instance", "Getter not initialized") ;
334
335    return fgObjGetter ;
336            
337 }
338
339 //____________________________________________________________________________ 
340 Int_t AliEMCALGetter::MaxEvent() const 
341 {
342   // returns the number of events in the run (from TE)
343
344   AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
345   return static_cast<Int_t>(rl->GetNumberOfEvents()) ; 
346 }
347
348 //____________________________________________________________________________ 
349 TParticle * AliEMCALGetter::Primary(Int_t index) const
350 {
351   AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
352   return rl->Stack()->Particle(index) ; 
353
354
355 //____________________________________________________________________________ 
356 AliEMCAL * AliEMCALGetter:: EMCAL() const  
357 {
358   // returns the EMCAL object 
359   AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(EmcalLoader()->GetModulesFolder()->FindObject("EMCAL")) ;  
360   if (!emcal) 
361     if (fgDebug)
362       Warning("EMCAL", "EMCAL module not found in module folders: %s", EmcalLoader()->GetModulesFolder()->GetName() ) ; 
363   return emcal ; 
364 }  
365
366
367
368 //____________________________________________________________________________ 
369 AliEMCALPID * AliEMCALGetter::PID() 
370
371   // return pointer to PID Tree
372   AliEMCALPID * rv ; 
373   rv =  dynamic_cast<AliEMCALPID *>(EmcalLoader()->PIDTask()) ;
374   if (!rv) {
375     Event(0, "P") ; 
376     rv =  dynamic_cast<AliEMCALPID *>(EmcalLoader()->PIDTask()) ;
377   }
378   return rv ; 
379 }
380
381 //____________________________________________________________________________ 
382 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() const 
383 {
384   // Returns EMCAL geometry
385
386   AliEMCALGeometry * rv = 0 ; 
387   if (EMCAL() )
388     rv =  EMCAL()->GetGeometry() ;
389   return rv ; 
390
391
392 //____________________________________________________________________________ 
393 TClonesArray * AliEMCALGetter::Primaries()  
394 {
395   // creates the Primaries container if needed
396   if ( !fPrimaries ) {
397     if (fgDebug) 
398       Info("Primaries", "Creating a new TClonesArray for primaries") ; 
399     fPrimaries = new TClonesArray("TParticle", 1000) ;
400   } 
401   return fPrimaries ; 
402 }
403
404 //____________________________________________________________________________ 
405 void  AliEMCALGetter::Print() 
406 {
407   // Print usefull information about the getter
408     
409   AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
410   ::Info("Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ; 
411 }
412
413 //____________________________________________________________________________ 
414 void AliEMCALGetter::ReadPrimaries()  
415 {
416   // Read Primaries from Kinematics.root
417   
418   AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
419   
420   // gets kine tree from the root file (Kinematics.root)
421   if ( ! rl->TreeK() )  // load treeK the first time
422     rl->LoadKinematics() ;
423   
424   fNPrimaries = rl->Stack()->GetNtrack() ; 
425
426   if (fgDebug) 
427     Info("ReadTreeK", "Found %d particles in event # %d", fNPrimaries, EventNumber() ) ; 
428
429
430   // first time creates the container
431   if ( Primaries() ) 
432     fPrimaries->Clear() ; 
433   
434   Int_t index = 0 ; 
435   for (index = 0 ; index < fNPrimaries; index++) { 
436     new ((*fPrimaries)[index]) TParticle(*(Primary(index)));
437   }
438 }
439
440 //____________________________________________________________________________ 
441 Int_t AliEMCALGetter::ReadTreeD()
442 {
443   // Read the Digits
444   
445   
446   // gets TreeD from the root file (EMCAL.SDigits.root)
447   if ( !IsLoaded("D") ) {
448     EmcalLoader()->LoadDigits("UPDATE") ;
449     EmcalLoader()->LoadDigitizer("UPDATE") ;
450     SetLoaded("D") ; 
451   } 
452   return Digits()->GetEntries() ; 
453 }
454
455 //____________________________________________________________________________ 
456 Int_t AliEMCALGetter::ReadTreeH()
457 {
458   // Read the Hits
459     
460   // gets TreeH from the root file (EMCAL.Hit.root)
461   if ( !IsLoaded("H") ) {
462     EmcalLoader()->LoadHits("UPDATE") ;
463     SetLoaded("H") ; 
464   }  
465   return Hits()->GetEntries() ; 
466 }
467
468 //____________________________________________________________________________ 
469 Int_t AliEMCALGetter::ReadTreeR()
470 {
471   // Read the RecPoints
472   
473   
474   // gets TreeR from the root file (EMCAL.RecPoints.root)
475   if ( !IsLoaded("R") ) {
476     EmcalLoader()->LoadRecPoints("UPDATE") ;
477     EmcalLoader()->LoadClusterizer("UPDATE") ;
478     SetLoaded("R") ; 
479   }
480
481   return ECARecPoints()->GetEntries() ; 
482 }
483
484 //____________________________________________________________________________ 
485 Int_t AliEMCALGetter::ReadTreeT()
486 {
487   // Read the TrackSegments
488   
489   
490   // gets TreeT from the root file (EMCAL.TrackSegments.root)
491   if ( !IsLoaded("T") ) {
492     EmcalLoader()->LoadTracks("UPDATE") ;
493     EmcalLoader()->LoadTrackSegmentMaker("UPDATE") ;
494     SetLoaded("T") ; 
495   }
496
497   return TrackSegments()->GetEntries() ; 
498 }
499 //____________________________________________________________________________ 
500 Int_t AliEMCALGetter::ReadTreeP()
501 {
502   // Read the TrackSegments
503   
504   
505   // gets TreeT from the root file (EMCAL.TrackSegments.root)
506   if ( !IsLoaded("P") ) {
507     EmcalLoader()->LoadRecParticles("UPDATE") ;
508     EmcalLoader()->LoadPID("UPDATE") ;
509     SetLoaded("P") ; 
510   }
511
512   return RecParticles()->GetEntries() ; 
513 }
514 //____________________________________________________________________________ 
515 Int_t AliEMCALGetter::ReadTreeS()
516 {
517   // Read the SDigits
518   
519   
520   // gets TreeS from the root file (EMCAL.SDigits.root)
521   if ( !IsLoaded("S") ) {
522     EmcalLoader()->LoadSDigits("UPDATE") ;
523     EmcalLoader()->LoadSDigitizer("UPDATE") ;
524     SetLoaded("S") ; 
525   }
526
527   return SDigits()->GetEntries() ; 
528 }
529
530 //____________________________________________________________________________ 
531 TClonesArray * AliEMCALGetter::SDigits() const  
532 {
533   // asks the Loader to return the Digits container 
534
535   TClonesArray * rv = 0 ; 
536   
537   rv = EmcalLoader()->SDigits() ; 
538   if (!rv) {
539     EmcalLoader()->MakeSDigitsArray() ;
540     rv = EmcalLoader()->SDigits() ; 
541   }
542   return rv ; 
543 }
544
545 //____________________________________________________________________________ 
546 AliEMCALSDigitizer * AliEMCALGetter::SDigitizer() 
547
548   // Return pointer to SDigitizer task
549   AliEMCALSDigitizer * rv ; 
550   rv =  dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
551   if (!rv) {
552     Event(0, "S") ; 
553     rv =  dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
554   }
555   return rv ; 
556 }
557
558 //____________________________________________________________________________ 
559 TParticle * AliEMCALGetter::Secondary(const TParticle* p, Int_t index) const
560 {
561   // Return first (index=1) or second (index=2) secondary particle of primary particle p 
562
563   if(index <= 0) 
564     return 0 ;
565   if(index > 2)
566     return 0 ;
567
568   if(p) {
569   Int_t daughterIndex = p->GetDaughter(index-1) ; 
570   AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
571   return  rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ; 
572   }
573   else
574     return 0 ;
575 }
576
577 //____________________________________________________________________________ 
578 void AliEMCALGetter::Track(Int_t itrack) 
579 {
580   // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
581  
582  AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
583
584   if( !TreeH() ) // load treeH the first time
585     rl->LoadHits() ;
586
587   // first time create the container
588   TClonesArray * hits = Hits() ; 
589   if ( hits ) 
590     hits->Clear() ; 
591
592   TBranch * emcalbranch = dynamic_cast<TBranch*>(TreeH()->GetBranch("EMCAL")) ; 
593   emcalbranch->SetAddress(&hits) ;
594   emcalbranch->GetEntry(itrack) ;
595 }
596
597 //____________________________________________________________________________ 
598 TTree * AliEMCALGetter::TreeD() const 
599 {
600   // return pointer to Digits Tree
601   TTree * rv = 0 ; 
602   rv = EmcalLoader()->TreeD() ; 
603   if ( !rv ) {
604     EmcalLoader()->MakeTree("D");
605     rv = EmcalLoader()->TreeD() ;
606   } 
607   
608   return rv ; 
609 }
610
611 //____________________________________________________________________________ 
612 TTree * AliEMCALGetter::TreeH() const 
613 {
614   // return pointer to Hits Tree
615   TTree * rv = 0 ; 
616   rv = EmcalLoader()->TreeH() ; 
617   if ( !rv ) {
618     EmcalLoader()->MakeTree("H");
619     rv = EmcalLoader()->TreeH() ;
620   } 
621   
622   return rv ; 
623 }
624
625 //____________________________________________________________________________ 
626 TTree * AliEMCALGetter::TreeR() const 
627 {
628   // return pointer to RecPoints Tree
629
630   TTree * rv = 0 ; 
631   rv = EmcalLoader()->TreeR() ; 
632   if ( !rv ) {
633     EmcalLoader()->MakeTree("R");
634     rv = EmcalLoader()->TreeR() ;
635   } 
636   
637   return rv ; 
638 }
639
640 //____________________________________________________________________________ 
641 TTree * AliEMCALGetter::TreeT() const 
642 {  
643   // return pointer to TrackSegments Tree
644   TTree * rv = 0 ; 
645   rv = EmcalLoader()->TreeT() ; 
646   if ( !rv ) {
647     EmcalLoader()->MakeTree("T");
648     rv = EmcalLoader()->TreeT() ;
649   } 
650   
651   return rv ; 
652 }
653 //____________________________________________________________________________ 
654 TTree * AliEMCALGetter::TreeP() const 
655 {
656   // return pointer to RecParticles Tree
657   TTree * rv = 0 ; 
658   rv = EmcalLoader()->TreeP() ; 
659   if ( !rv ) {
660     EmcalLoader()->MakeTree("P");
661     rv = EmcalLoader()->TreeP() ;
662   } 
663   
664   return rv ; 
665 }
666
667 //____________________________________________________________________________ 
668 TTree * AliEMCALGetter::TreeS() const 
669 {
670   // return pointer to SDigits Tree
671   TTree * rv = 0 ; 
672   rv = EmcalLoader()->TreeS() ; 
673   if ( !rv ) {
674     EmcalLoader()->MakeTree("S");
675     rv = EmcalLoader()->TreeS() ;
676   } 
677   
678   return rv ; 
679 }
680
681 //____________________________________________________________________________ 
682 Bool_t AliEMCALGetter::VersionExists(TString & opt) const
683 {
684   // checks if the version with the present name already exists in the same directory
685
686   Bool_t rv = kFALSE ;
687  
688   AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
689   TString version( rl->GetEventFolder()->GetName() ) ; 
690
691   opt.ToLower() ; 
692   
693   if ( opt == "sdigits") {
694     // add the version name to the root file name
695     TString fileName( EmcalLoader()->GetSDigitsFileName() ) ; 
696     if (version != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name 
697       fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
698     if ( !(gSystem->AccessPathName(fileName)) ) { 
699       Warning("VersionExists", "The file %s already exists", fileName.Data()) ;
700       rv = kTRUE ; 
701     }
702     EmcalLoader()->SetSDigitsFileName(fileName) ;
703   }
704
705   if ( opt == "digits") {
706     // add the version name to the root file name
707     TString fileName( EmcalLoader()->GetDigitsFileName() ) ; 
708     if (version != AliConfig::fgkDefaultEventFolderName) // only if not the default folder name 
709       fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
710     if ( !(gSystem->AccessPathName(fileName)) ) {
711       Warning("VersionExists", "The file %s already exists", fileName.Data()) ;  
712       rv = kTRUE ; 
713     }
714   }
715
716   return rv ;
717
718 }
719
720 //____________________________________________________________________________ 
721 UShort_t AliEMCALGetter::EventPattern(void) const
722 {
723   // Return the pattern (trigger bit register) of the beam-test event
724 //   if(fBTE)
725 //     return fBTE->GetPattern() ;
726 //   else
727     return 0 ;
728 }
729 //____________________________________________________________________________ 
730 Float_t AliEMCALGetter::BeamEnergy(void) const
731 {
732   // Return the beam energy of the beam-test event
733 //   if(fBTE)
734 //     return fBTE->GetBeamEnergy() ;
735 //   else
736     return 0 ;
737 }