]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALGetter.cxx
Introduced option for the first and last event to process
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGetter.cxx
CommitLineData
ffa6d63b 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
803d1ab0 16/* $Id$ */
ffa6d63b 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
88cb7938 22// ensures, that one reads Digits, made of these particular digits, RecPoints,
ffa6d63b 23// made of these particular RecPoints, TrackSegments and RecParticles.
24// This becomes non trivial if there are several identical branches, produced with
d75bea67 25// different set of parameters.
ffa6d63b 26//
27// An example of how to use (see also class AliEMCALAnalyser):
28// AliEMCALGetter * gime = AliEMCALGetter::GetInstance("galice.root","test") ;
d75bea67 29// for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
30// AliEMCALRecParticle * part = gime->RecParticle(1) ;
ffa6d63b 31// ................
88cb7938 32// gime->Event(event) ; // reads new event from galice.root
ffa6d63b 33//
d75bea67 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
88cb7938 38//*-- systematic usage of TFolders without changing the interface
ffa6d63b 39//////////////////////////////////////////////////////////////////////////////
40
ffa6d63b 41// --- ROOT system ---
173558f2 42
88cb7938 43#include "TSystem.h"
ffa6d63b 44#include "TROOT.h"
1ce25ac8 45
ffa6d63b 46
47// --- Standard library ---
173558f2 48
ffa6d63b 49// --- AliRoot header files ---
1ce25ac8 50
ffa6d63b 51#include "AliEMCALGetter.h"
d64c959b 52#include "AliEMCAL.h"
88cb7938 53#include "AliRunLoader.h"
54#include "AliStack.h"
55#include "AliEMCALLoader.h"
5d12ce38 56#include "AliMC.h"
ffa6d63b 57
58ClassImp(AliEMCALGetter)
88cb7938 59
60AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
61AliEMCALLoader * AliEMCALGetter::fgEmcalLoader = 0;
62Int_t AliEMCALGetter::fgDebug = 0;
173558f2 63
88cb7938 64// TFile * AliEMCALGetter::fgFile = 0 ;
ffa6d63b 65
66//____________________________________________________________________________
88cb7938 67AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* version, Option_t * openingOption)
ffa6d63b 68{
88cb7938 69 // ctor only called by Instance()
d75bea67 70
88cb7938 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
ba298680 81 }
ffa6d63b 82 }
88cb7938 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 = "" ;
ffa6d63b 95}
05a92d59 96
ffa6d63b 97//____________________________________________________________________________
ba298680 98AliEMCALGetter::~AliEMCALGetter()
99{
88cb7938 100 // dtor
101 delete fgEmcalLoader ;
102 fgEmcalLoader = 0 ;
103 //delete fBTE ;
104 // fBTE = 0 ;
105 fPrimaries->Delete() ;
106 delete fPrimaries ;
107}
d489fb96 108
88cb7938 109//____________________________________________________________________________
110AliEMCALClusterizer * AliEMCALGetter::Clusterizer()
111{
1ce25ac8 112 // return pointer to Clusterizer Tree
88cb7938 113 AliEMCALClusterizer * rv ;
114 rv = dynamic_cast<AliEMCALClusterizer *>(EmcalLoader()->Reconstructioner()) ;
115 if (!rv) {
116 Event(0, "R") ;
117 rv = dynamic_cast<AliEMCALClusterizer*>(EmcalLoader()->Reconstructioner()) ;
05a92d59 118 }
88cb7938 119 return rv ;
ffa6d63b 120}
121
173558f2 122
88cb7938 123//____________________________________________________________________________
1ce25ac8 124TClonesArray * AliEMCALGetter::Digits() const
65549808 125{
88cb7938 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 ;
65549808 136}
137
ffa6d63b 138//____________________________________________________________________________
88cb7938 139AliEMCALDigitizer * AliEMCALGetter::Digitizer()
140{
1ce25ac8 141 // return pointer to Digitizer Tree
88cb7938 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}
173558f2 150
0c87da39 151//____________________________________________________________________________
1ce25ac8 152TObjArray * AliEMCALGetter::ECARecPoints() const
ffa6d63b 153{
88cb7938 154 // asks the Loader to return the EMC RecPoints container
173558f2 155
88cb7938 156 TObjArray * rv = 0 ;
157
158 rv = EmcalLoader()->ECARecPoints() ;
159 if (!rv) {
160 EmcalLoader()->MakeRecPointsArray() ;
161 rv = EmcalLoader()->ECARecPoints() ;
b134c32f 162 }
88cb7938 163 return rv ;
ffa6d63b 164}
165
05a92d59 166//____________________________________________________________________________
1ce25ac8 167TClonesArray * AliEMCALGetter::TrackSegments() const
05a92d59 168{
88cb7938 169 // asks the Loader to return the TrackSegments container
05a92d59 170
88cb7938 171 TClonesArray * rv = 0 ;
172
173 rv = EmcalLoader()->TrackSegments() ;
174 if (!rv) {
175 EmcalLoader()->MakeTrackSegmentsArray() ;
176 rv = EmcalLoader()->TrackSegments() ;
05a92d59 177 }
88cb7938 178 return rv ;
179}
173558f2 180
88cb7938 181//____________________________________________________________________________
182AliEMCALTrackSegmentMaker * AliEMCALGetter::TrackSegmentMaker()
183{
1ce25ac8 184 // return pointer to TrackSegmentMaker Tree
88cb7938 185 AliEMCALTrackSegmentMaker * rv ;
186 rv = dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
187 if (!rv) {
188 Event(0, "T") ;
189 rv = dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
48f12df6 190 }
88cb7938 191 return rv ;
05a92d59 192}
6c58180f 193
05a92d59 194//____________________________________________________________________________
1ce25ac8 195TClonesArray * AliEMCALGetter::RecParticles() const
88cb7938 196{
197 // asks the Loader to return the TrackSegments container
173558f2 198
88cb7938 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//____________________________________________________________________________
09884213 209void AliEMCALGetter::Event(Int_t event, const char* opt)
05a92d59 210{
88cb7938 211 // Reads the content of all Tree's S, D and R
d489fb96 212
88cb7938 213 if ( event >= MaxEvent() ) {
214 Error("Event", "%d not found in TreeE !", event) ;
215 return ;
216 }
173558f2 217
88cb7938 218 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
173558f2 219
88cb7938 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// }
173558f2 234
88cb7938 235 // Loads the type of object(s) requested
236
237 rl->GetEvent(event) ;
173558f2 238
88cb7938 239 if( strstr(opt,"X") || (strcmp(opt,"")==0) )
240 ReadPrimaries() ;
173558f2 241
88cb7938 242 if(strstr(opt,"H") )
243 ReadTreeH();
173558f2 244
88cb7938 245 if(strstr(opt,"S") )
246 ReadTreeS() ;
173558f2 247
88cb7938 248 if( strstr(opt,"D") )
249 ReadTreeD() ;
173558f2 250
88cb7938 251 if( strstr(opt,"R") )
252 ReadTreeR() ;
173558f2 253
88cb7938 254 if( strstr(opt,"T") )
255 ReadTreeT() ;
173558f2 256
88cb7938 257 if( strstr(opt,"P") )
258 ReadTreeP() ;
88cb7938 259
05a92d59 260}
261
88cb7938 262
05a92d59 263//____________________________________________________________________________
88cb7938 264Int_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}
173558f2 270
88cb7938 271//____________________________________________________________________________
1ce25ac8 272 TClonesArray * AliEMCALGetter::Hits() const
05a92d59 273{
88cb7938 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 ;
05a92d59 284}
285
286//____________________________________________________________________________
88cb7938 287AliEMCALGetter * AliEMCALGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption)
05a92d59 288{
88cb7938 289 // Creates and returns the pointer of the unique instance
290 // Must be called only when the environment has changed
291
88cb7938 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 }
05a92d59 314 }
88cb7938 315 else
316 fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;
05a92d59 317 }
88cb7938 318 if (!fgObjGetter)
9e5dd82c 319 ::Error("AliEMCALGetter::Instance", "Failed to create the EMCAL Getter object") ;
88cb7938 320 else
321 if (fgDebug)
322 Print() ;
323
324 return fgObjGetter ;
ffa6d63b 325}
326
327//____________________________________________________________________________
88cb7938 328AliEMCALGetter * AliEMCALGetter::Instance()
329{
330 // Returns the pointer of the unique instance already defined
331
9e5dd82c 332 if(!fgObjGetter && fgDebug)
333 ::Warning("AliEMCALGetter::Instance", "Getter not initialized") ;
88cb7938 334
335 return fgObjGetter ;
336
337}
173558f2 338
88cb7938 339//____________________________________________________________________________
340Int_t AliEMCALGetter::MaxEvent() const
ffa6d63b 341{
88cb7938 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}
173558f2 347
88cb7938 348//____________________________________________________________________________
349TParticle * AliEMCALGetter::Primary(Int_t index) const
350{
351 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
352 return rl->Stack()->Particle(index) ;
353}
173558f2 354
88cb7938 355//____________________________________________________________________________
356AliEMCAL * AliEMCALGetter:: EMCAL() const
357{
358 // returns the EMCAL object
359 AliEMCAL * emcal = dynamic_cast<AliEMCAL*>(EmcalLoader()->GetModulesFolder()->FindObject("EMCAL")) ;
ffa6d63b 360 if (!emcal)
88cb7938 361 if (fgDebug)
362 Warning("EMCAL", "EMCAL module not found in module folders: %s", EmcalLoader()->GetModulesFolder()->GetName() ) ;
ffa6d63b 363 return emcal ;
364}
365
88cb7938 366
367
ffa6d63b 368//____________________________________________________________________________
88cb7938 369AliEMCALPID * AliEMCALGetter::PID()
370{
1ce25ac8 371 // return pointer to PID Tree
88cb7938 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}
173558f2 380
88cb7938 381//____________________________________________________________________________
382AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() const
ffa6d63b 383{
88cb7938 384 // Returns EMCAL geometry
385
ffa6d63b 386 AliEMCALGeometry * rv = 0 ;
387 if (EMCAL() )
d75bea67 388 rv = EMCAL()->GetGeometry() ;
ffa6d63b 389 return rv ;
390}
391
9bd3caba 392//____________________________________________________________________________
88cb7938 393TClonesArray * AliEMCALGetter::Primaries()
394{
395 // creates the Primaries container if needed
396 if ( !fPrimaries ) {
397 if (fgDebug)
b7de6a56 398 Info("Primaries", "Creating a new TClonesArray for primaries") ;
88cb7938 399 fPrimaries = new TClonesArray("TParticle", 1000) ;
400 }
401 return fPrimaries ;
402}
9bd3caba 403
404//____________________________________________________________________________
88cb7938 405void AliEMCALGetter::Print()
406{
407 // Print usefull information about the getter
408
409 AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
b7de6a56 410 ::Info("Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ;
88cb7938 411}
173558f2 412
88cb7938 413//____________________________________________________________________________
414void 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() ;
173558f2 425
88cb7938 426 if (fgDebug)
b7de6a56 427 Info("ReadTreeK", "Found %d particles in event # %d", fNPrimaries, EventNumber() ) ;
173558f2 428
173558f2 429
88cb7938 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)));
9bd3caba 437 }
9bd3caba 438}
439
ffa6d63b 440//____________________________________________________________________________
88cb7938 441Int_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}
ffa6d63b 454
455//____________________________________________________________________________
88cb7938 456Int_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}
173558f2 467
88cb7938 468//____________________________________________________________________________
469Int_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") ;
ffa6d63b 479 }
173558f2 480
88cb7938 481 return ECARecPoints()->GetEntries() ;
ffa6d63b 482}
483
484//____________________________________________________________________________
88cb7938 485Int_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") ;
ffa6d63b 495 }
173558f2 496
88cb7938 497 return TrackSegments()->GetEntries() ;
498}
ffa6d63b 499//____________________________________________________________________________
88cb7938 500Int_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 }
173558f2 511
88cb7938 512 return RecParticles()->GetEntries() ;
513}
514//____________________________________________________________________________
515Int_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 }
ffa6d63b 526
88cb7938 527 return SDigits()->GetEntries() ;
528}
173558f2 529
88cb7938 530//____________________________________________________________________________
1ce25ac8 531TClonesArray * AliEMCALGetter::SDigits() const
88cb7938 532{
533 // asks the Loader to return the Digits container
173558f2 534
88cb7938 535 TClonesArray * rv = 0 ;
536
537 rv = EmcalLoader()->SDigits() ;
538 if (!rv) {
539 EmcalLoader()->MakeSDigitsArray() ;
540 rv = EmcalLoader()->SDigits() ;
ffa6d63b 541 }
88cb7938 542 return rv ;
543}
ffa6d63b 544
88cb7938 545//____________________________________________________________________________
546AliEMCALSDigitizer * AliEMCALGetter::SDigitizer()
547{
b7de6a56 548 // Return pointer to SDigitizer task
88cb7938 549 AliEMCALSDigitizer * rv ;
550 rv = dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
551 if (!rv) {
552 Event(0, "S") ;
553 rv = dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
ffa6d63b 554 }
88cb7938 555 return rv ;
556}
557
558//____________________________________________________________________________
09884213 559TParticle * AliEMCALGetter::Secondary(const TParticle* p, Int_t index) const
88cb7938 560{
561 // Return first (index=1) or second (index=2) secondary particle of primary particle p
ffa6d63b 562
88cb7938 563 if(index <= 0)
564 return 0 ;
565 if(index > 2)
566 return 0 ;
173558f2 567
88cb7938 568 if(p) {
569 Int_t daughterIndex = p->GetDaughter(index-1) ;
570 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
5d12ce38 571 return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ;
05a92d59 572 }
88cb7938 573 else
574 return 0 ;
ffa6d63b 575}
576
577//____________________________________________________________________________
09884213 578void AliEMCALGetter::Track(Int_t itrack)
88cb7938 579{
580 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
581
582 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
173558f2 583
88cb7938 584 if( !TreeH() ) // load treeH the first time
585 rl->LoadHits() ;
ffa6d63b 586
88cb7938 587 // first time create the container
588 TClonesArray * hits = Hits() ;
589 if ( hits )
590 hits->Clear() ;
173558f2 591
88cb7938 592 TBranch * emcalbranch = dynamic_cast<TBranch*>(TreeH()->GetBranch("EMCAL")) ;
593 emcalbranch->SetAddress(&hits) ;
594 emcalbranch->GetEntry(itrack) ;
595}
ffa6d63b 596
ffa6d63b 597//____________________________________________________________________________
88cb7938 598TTree * AliEMCALGetter::TreeD() const
ffa6d63b 599{
1ce25ac8 600 // return pointer to Digits Tree
88cb7938 601 TTree * rv = 0 ;
602 rv = EmcalLoader()->TreeD() ;
603 if ( !rv ) {
604 EmcalLoader()->MakeTree("D");
605 rv = EmcalLoader()->TreeD() ;
9859bfc0 606 }
88cb7938 607
608 return rv ;
ffa6d63b 609}
9bd3caba 610
ffa6d63b 611//____________________________________________________________________________
88cb7938 612TTree * AliEMCALGetter::TreeH() const
ffa6d63b 613{
1ce25ac8 614 // return pointer to Hits Tree
88cb7938 615 TTree * rv = 0 ;
616 rv = EmcalLoader()->TreeH() ;
617 if ( !rv ) {
618 EmcalLoader()->MakeTree("H");
619 rv = EmcalLoader()->TreeH() ;
620 }
621
622 return rv ;
9859bfc0 623}
173558f2 624
ffa6d63b 625//____________________________________________________________________________
88cb7938 626TTree * AliEMCALGetter::TreeR() const
ffa6d63b 627{
1ce25ac8 628 // return pointer to RecPoints Tree
629
88cb7938 630 TTree * rv = 0 ;
631 rv = EmcalLoader()->TreeR() ;
632 if ( !rv ) {
633 EmcalLoader()->MakeTree("R");
634 rv = EmcalLoader()->TreeR() ;
635 }
636
637 return rv ;
ffa6d63b 638}
173558f2 639
ffa6d63b 640//____________________________________________________________________________
88cb7938 641TTree * AliEMCALGetter::TreeT() const
1ce25ac8 642{
643 // return pointer to TrackSegments Tree
88cb7938 644 TTree * rv = 0 ;
645 rv = EmcalLoader()->TreeT() ;
646 if ( !rv ) {
647 EmcalLoader()->MakeTree("T");
648 rv = EmcalLoader()->TreeT() ;
649 }
516fff8e 650
88cb7938 651 return rv ;
ffa6d63b 652}
65549808 653//____________________________________________________________________________
88cb7938 654TTree * AliEMCALGetter::TreeP() const
65549808 655{
1ce25ac8 656 // return pointer to RecParticles Tree
88cb7938 657 TTree * rv = 0 ;
658 rv = EmcalLoader()->TreeP() ;
659 if ( !rv ) {
660 EmcalLoader()->MakeTree("P");
661 rv = EmcalLoader()->TreeP() ;
05a92d59 662 }
88cb7938 663
664 return rv ;
65549808 665}
173558f2 666
65549808 667//____________________________________________________________________________
88cb7938 668TTree * AliEMCALGetter::TreeS() const
65549808 669{
1ce25ac8 670 // return pointer to SDigits Tree
88cb7938 671 TTree * rv = 0 ;
672 rv = EmcalLoader()->TreeS() ;
673 if ( !rv ) {
674 EmcalLoader()->MakeTree("S");
675 rv = EmcalLoader()->TreeS() ;
676 }
677
678 return rv ;
65549808 679}
680
681//____________________________________________________________________________
88cb7938 682Bool_t AliEMCALGetter::VersionExists(TString & opt) const
65549808 683{
88cb7938 684 // checks if the version with the present name already exists in the same directory
05a92d59 685
88cb7938 686 Bool_t rv = kFALSE ;
687
688 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
689 TString version( rl->GetEventFolder()->GetName() ) ;
173558f2 690
88cb7938 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 ;
05a92d59 701 }
88cb7938 702 EmcalLoader()->SetSDigitsFileName(fileName) ;
05a92d59 703 }
173558f2 704
88cb7938 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 ;
05a92d59 713 }
714 }
715
88cb7938 716 return rv ;
173558f2 717
05a92d59 718}
173558f2 719
05a92d59 720//____________________________________________________________________________
88cb7938 721UShort_t AliEMCALGetter::EventPattern(void) const
05a92d59 722{
88cb7938 723 // Return the pattern (trigger bit register) of the beam-test event
724// if(fBTE)
725// return fBTE->GetPattern() ;
726// else
727 return 0 ;
05a92d59 728}
729//____________________________________________________________________________
88cb7938 730Float_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 ;
9859bfc0 737}