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 //_________________________________________________________________________
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.
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) ;
32 // gime->Event(event) ; // reads new event from galice.root
34 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
35 //*-- Completely redesigned by Dmitri Peressounko March 2001
37 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
38 //*-- systematic usage of TFolders without changing the interface
39 //////////////////////////////////////////////////////////////////////////////
41 // --- ROOT system ---
48 //#include <TCanvas.h>
51 // --- Standard library ---
53 // --- AliRoot header files ---
56 #include "AliEMCALGetter.h"
57 #include "AliEMCALLoader.h"
58 #include "AliHeader.h"
60 #include "AliRunLoader.h"
62 #include "AliEMCALRawStream.h"
63 #include "AliRawReaderFile.h"
65 ClassImp(AliEMCALGetter)
67 AliEMCALGetter * AliEMCALGetter::fgObjGetter = 0 ;
68 AliEMCALLoader * AliEMCALGetter::fgEmcalLoader = 0;
69 Int_t AliEMCALGetter::fgDebug = 0;
70 TString AliEMCALGetter::fVersion = "";
72 // TFile * AliEMCALGetter::fgFile = 0 ;
74 //____________________________________________________________________________
75 AliEMCALGetter::AliEMCALGetter(const char* headerFile, const char* version, Option_t * openingOption)
77 // ctor only called by Instance()
79 // initialize data members
87 OpenFile(headerFile,version,openingOption);
91 //____________________________________________________________________________
92 AliEMCALGetter::~AliEMCALGetter()
94 //PH AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
101 //____________________________________________________________________________
102 void AliEMCALGetter::OpenFile(const char* headerFile, const char* version, Option_t * openingOption) {
104 AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ;
106 rl = AliRunLoader::Open(headerFile, version, openingOption);
108 Fatal("AliEMCALGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ;
111 if (rl->GetAliRun() == 0x0) {
113 gAlice = rl->GetAliRun(); // should be removed
116 fgEmcalLoader = dynamic_cast<AliEMCALLoader*>(rl->GetLoader("EMCALLoader"));
117 if ( !fgEmcalLoader )
118 Error("AliEMCALGetter", "Could not find EMCALLoader") ;
120 fgEmcalLoader->SetTitle(version);
123 //____________________________________________________________________________
124 void AliEMCALGetter::Reset()
126 // resets things in case the getter is called consecutively with different files
127 // the EMCAL Loader is already deleted by the Run Loader
131 //____________________________________________________________________________
132 AliEMCALClusterizer * AliEMCALGetter::Clusterizer()
134 // return pointer to Clusterizer Tree
135 AliEMCALClusterizer * rv ;
136 rv = dynamic_cast<AliEMCALClusterizer *>(EmcalLoader()->Reconstructioner()) ;
139 rv = dynamic_cast<AliEMCALClusterizer*>(EmcalLoader()->Reconstructioner()) ;
145 //____________________________________________________________________________
146 TClonesArray * AliEMCALGetter::Digits() const
148 // asks the Loader to return the Digits container
150 TClonesArray * rv = 0 ;
151 rv = EmcalLoader()->Digits() ;
154 EmcalLoader()->MakeDigitsArray() ;
155 rv = EmcalLoader()->Digits() ;
160 //____________________________________________________________________________
161 AliEMCALDigitizer * AliEMCALGetter::Digitizer()
163 // return pointer to Digitizer Tree
164 AliEMCALDigitizer * rv ;
165 rv = dynamic_cast<AliEMCALDigitizer *>(EmcalLoader()->Digitizer()) ;
168 rv = dynamic_cast<AliEMCALDigitizer *>(EmcalLoader()->Digitizer()) ;
173 //____________________________________________________________________________
174 TObjArray * AliEMCALGetter::ECARecPoints() const
176 // asks the Loader to return the EMC RecPoints container
180 rv = EmcalLoader()->ECARecPoints() ;
182 EmcalLoader()->MakeRecPointsArray() ;
183 rv = EmcalLoader()->ECARecPoints() ;
188 //____________________________________________________________________________
189 TClonesArray * AliEMCALGetter::TrackSegments() const
191 // asks the Loader to return the TrackSegments container
193 TClonesArray * rv = 0 ;
195 rv = EmcalLoader()->TrackSegments() ;
197 EmcalLoader()->MakeTrackSegmentsArray() ;
198 rv = EmcalLoader()->TrackSegments() ;
203 //____________________________________________________________________________
204 AliEMCALTrackSegmentMaker * AliEMCALGetter::TrackSegmentMaker()
206 // return pointer to TrackSegmentMaker Tree
207 AliEMCALTrackSegmentMaker * rv ;
208 rv = dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
211 rv = dynamic_cast<AliEMCALTrackSegmentMaker *>(EmcalLoader()->TrackSegmentMaker()) ;
216 //____________________________________________________________________________
217 TClonesArray * AliEMCALGetter::RecParticles() const
219 // asks the Loader to return the TrackSegments container
221 TClonesArray * rv = 0 ;
223 rv = EmcalLoader()->RecParticles() ;
225 EmcalLoader()->MakeRecParticlesArray() ;
226 rv = EmcalLoader()->RecParticles() ;
230 //____________________________________________________________________________
231 void AliEMCALGetter::Event(Int_t event, const char* opt)
233 // Reads the content of all Tree's S, D and R
235 if ( event >= MaxEvent() ) {
236 Error("Event", "%d not found in TreeE !", event) ;
240 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
241 // checks if we are dealing with test-beam data
242 // TBranch * btb = rl->TreeE()->GetBranch("AliEMCALBeamTestEvent") ;
245 // fBTE = new AliEMCALBeamTestEvent() ;
246 // btb->SetAddress(&fBTE) ;
247 // btb->GetEntry(event) ;
256 // Loads the type of object(s) requested
258 rl->GetEvent(event) ;
260 if( strstr(opt,"X") || (strcmp(opt,"")==0) )
269 if( strstr(opt,"D") )
272 if( strstr(opt,"R") )
275 if( strstr(opt,"T") )
278 if( strstr(opt,"P") )
281 if( strstr(opt,"W") )
287 //____________________________________________________________________________
288 Int_t AliEMCALGetter::EventNumber() const
290 // return the current event number
291 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
292 return static_cast<Int_t>(rl->GetEventNumber()) ;
295 //____________________________________________________________________________
296 TClonesArray * AliEMCALGetter::Hits() const
298 // asks the loader to return the Hits container
300 TClonesArray * rv = 0 ;
302 rv = EmcalLoader()->Hits() ;
304 EmcalLoader()->LoadHits("read");
305 rv = EmcalLoader()->Hits() ;
310 //____________________________________________________________________________
311 AliEMCALGetter * AliEMCALGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption)
313 // Creates and returns the pointer of the unique instance
314 // Must be called only when the environment has changed
316 if(!fgObjGetter){ // first time the getter is called
317 fgObjGetter = new AliEMCALGetter(alirunFileName, version, openingOption) ;
319 else { // the getter has been called previously
320 AliRunLoader * rl = AliRunLoader::GetRunLoader(fVersion);
321 if (rl == 0) fgObjGetter->OpenFile(alirunFileName, version, openingOption) ;
322 else if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name
323 // check if the file is already open
324 TFile * galiceFile = dynamic_cast<TFile *>(gROOT->FindObject(rl->GetFileName()) ) ;
327 fgObjGetter->OpenFile(alirunFileName, version, openingOption);
329 else { // the file is already open check the version name
330 TString currentVersionName = rl->GetEventFolder()->GetName() ;
331 TString newVersionName(version) ;
332 if (currentVersionName == newVersionName)
334 ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ;
336 fgEmcalLoader->SetTitle(version); fVersion = version;
341 AliRunLoader * rl = AliRunLoader::GetRunLoader(fVersion);
342 if ( strstr(version, AliConfig::GetDefaultEventFolderName()) ) // false in case of merging
344 fgObjGetter->OpenFile(alirunFileName, version, openingOption) ;
348 ::Error("AliEMCALGetter::Instance", "Failed to create the EMCAL Getter object") ;
356 //____________________________________________________________________________
357 AliEMCALGetter * AliEMCALGetter::Instance()
359 // Returns the pointer of the unique instance already defined
361 if(!fgObjGetter && fgDebug)
362 ::Warning("AliEMCALGetter::Instance", "Getter not initialized") ;
368 //____________________________________________________________________________
369 Int_t AliEMCALGetter::MaxEvent() const
371 // returns the number of events in the run (from TE)
373 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
374 return static_cast<Int_t>(rl->GetNumberOfEvents()) ;
377 //____________________________________________________________________________
378 TParticle * AliEMCALGetter::Primary(Int_t index) const
380 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
381 return rl->Stack()->Particle(index) ;
384 //____________________________________________________________________________
385 Int_t AliEMCALGetter::NPrimaries() const
387 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
388 return (rl->GetHeader())->GetNtrack();
391 //____________________________________________________________________________
392 AliEMCAL * AliEMCALGetter:: EMCAL() const
394 // returns the EMCAL object
395 AliEMCALLoader * loader = 0;
396 static AliEMCALLoader * oldloader = 0;
397 static AliEMCAL * emcal = 0;
399 loader = EmcalLoader();
401 if (loader != oldloader ) {
402 emcal = dynamic_cast<AliEMCAL*>(loader->GetModulesFolder()->FindObject("EMCAL")) ;
407 Warning("EMCAL", "EMCAL module not found in module folders: %s", EmcalLoader()->GetModulesFolder()->GetName() ) ;
413 //____________________________________________________________________________
414 AliEMCALPID * AliEMCALGetter::PID()
416 // return pointer to PID Tree
418 rv = dynamic_cast<AliEMCALPID *>(EmcalLoader()->PIDTask()) ;
421 rv = dynamic_cast<AliEMCALPID *>(EmcalLoader()->PIDTask()) ;
426 //____________________________________________________________________________
427 AliEMCALGeometry * AliEMCALGetter::EMCALGeometry() const
429 // Returns EMCAL geometry
431 AliEMCALGeometry * rv = 0 ;
433 rv = EMCAL()->GetGeometry() ;
437 //____________________________________________________________________________
438 void AliEMCALGetter::Print()
440 // Print usefull information about the getter
442 AliRunLoader * rl = AliRunLoader::GetRunLoader(fgEmcalLoader->GetTitle());
443 ::Info("Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ;
446 //____________________________________________________________________________
447 void AliEMCALGetter::ReadPrimaries()
449 // Read Primaries from Kinematics.root
451 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
453 // gets kine tree from the root file (Kinematics.root)
454 if ( ! rl->TreeK() ) // load treeK the first time
455 rl->LoadKinematics() ;
458 Info("ReadTreeK", "Found %d particles in event # %d", NPrimaries(), EventNumber() ) ;
461 //____________________________________________________________________________
462 void AliEMCALGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time)
464 // Fits the raw signal time distribution
466 const Int_t kNoiseThreshold = 0 ;
467 Double_t timezero1 = 0., timezero2 = 0., timemax = 0. ;
468 Double_t signal = 0., signalmax = 0. ;
469 Double_t energy = time = 0. ;
472 timezero1 = timezero2 = signalmax = timemax = 0. ;
473 signalF->FixParameter(0, EMCAL()->GetRawFormatLowCharge()) ;
474 signalF->FixParameter(1, EMCAL()->GetRawFormatLowGain()) ;
476 for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) {
477 gLowGain->GetPoint(index, time, signal) ;
478 if (signal > kNoiseThreshold && timezero1 == 0.)
480 if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.)
482 if (signal > signalmax) {
487 signalmax /= EMCAL()->RawResponseFunctionMax(EMCAL()->GetRawFormatLowCharge(),
488 EMCAL()->GetRawFormatLowGain()) ;
489 if ( timezero1 + EMCAL()->GetRawFormatTimePeak() < EMCAL()->GetRawFormatTimeMax() * 0.4 ) { // else its noise
490 signalF->SetParameter(2, signalmax) ;
491 signalF->SetParameter(3, timezero1) ;
492 gLowGain->Fit(signalF, "QRON", "", 0., timezero2); //, "QRON") ;
493 energy = signalF->GetParameter(2) ;
494 time = signalF->GetMaximumX() - EMCAL()->GetRawFormatTimePeak() - EMCAL()->GetRawFormatTimeTrigger() ;
497 timezero1 = timezero2 = signalmax = timemax = 0. ;
498 signalF->FixParameter(0, EMCAL()->GetRawFormatHighCharge()) ;
499 signalF->FixParameter(1, EMCAL()->GetRawFormatHighGain()) ;
501 for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) {
502 gHighGain->GetPoint(index, time, signal) ;
503 if (signal > kNoiseThreshold && timezero1 == 0.)
505 if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.)
507 if (signal > signalmax) {
512 signalmax /= EMCAL()->RawResponseFunctionMax(EMCAL()->GetRawFormatHighCharge(),
513 EMCAL()->GetRawFormatHighGain()) ;;
514 if ( timezero1 + EMCAL()->GetRawFormatTimePeak() < EMCAL()->GetRawFormatTimeMax() * 0.4 ) { // else its noise
515 signalF->SetParameter(2, signalmax) ;
516 signalF->SetParameter(3, timezero1) ;
517 gHighGain->Fit(signalF, "QRON", "", 0., timezero2) ;
518 energy = signalF->GetParameter(2) ;
519 time = signalF->GetMaximumX() - EMCAL()->GetRawFormatTimePeak() - EMCAL()->GetRawFormatTimeTrigger() ;
523 if (time == 0. && energy == 0.)
526 AliEMCALDigitizer * digitizer = Digitizer() ;
527 amp = static_cast<Int_t>( (energy - digitizer->GetECApedestal()) / digitizer->GetECAchannel() + 0.5 ) ;
530 // TCanvas * c1 = new TCanvas("c1","A Simple Graph Example",200,10,700,500);
531 // c1->SetFillColor(42);
533 // gLowGain->SetLineColor(2);
534 // gLowGain->SetLineWidth(4);
535 // gLowGain->SetMarkerColor(4);
536 // gLowGain->SetMarkerStyle(21);
537 // gLowGain->SetTitle("Lowgain");
538 // gLowGain->GetXaxis()->SetTitle("X title");
539 // gLowGain->GetYaxis()->SetTitle("Y title");
540 // gLowGain->Draw("ACP");
543 // c1->GetFrame()->SetFillColor(21);
544 // c1->GetFrame()->SetBorderSize(12);
547 // TCanvas * c2 = new TCanvas("c2","A Simple Graph Example",200,10,700,500);
548 // c2->SetFillColor(42);
550 // gHighGain->SetLineColor(2);
551 // gHighGain->SetLineWidth(4);
552 // gHighGain->SetMarkerColor(4);
553 // gHighGain->SetMarkerStyle(21);
554 // gHighGain->SetTitle("Highgain");
555 // gHighGain->GetXaxis()->SetTitle("X title");
556 // gHighGain->GetYaxis()->SetTitle("Y title");
557 // gHighGain->Draw("ACP");
560 // c2->GetFrame()->SetFillColor(21);
561 // c2->GetFrame()->SetBorderSize(12);
565 //____________________________________________________________________________
566 Int_t AliEMCALGetter::ReadRaw(Int_t event)
568 // reads the raw format data, converts it into digits format and store digits in Digits()
571 AliRawReaderFile rawReader(event) ;
572 AliEMCALRawStream in(&rawReader);
574 Bool_t first = kTRUE ;
576 TF1 * signalF = new TF1("signal", AliEMCAL::RawResponseFunction, 0, EMCAL()->GetRawFormatTimeMax(), 4);
577 signalF->SetParNames("Charge", "Gain", "Amplitude", "TimeZero") ;
581 Bool_t lowGainFlag = kFALSE ;
583 TClonesArray * digits = Digits() ;
589 TGraph * gLowGain = new TGraph(EMCAL()->GetRawFormatTimeBins()) ;
590 TGraph * gHighGain= new TGraph(EMCAL()->GetRawFormatTimeBins()) ;
592 while ( in.Next() ) { // EMCAL entries loop
593 if ( in.IsNewId() ) {
595 FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, amp, time) ;
597 new((*digits)[idigit]) AliEMCALDigit( -1, -1, id, amp, time) ;
601 for (index = 0; index < EMCAL()->GetRawFormatTimeBins(); index++) {
602 gLowGain->SetPoint(index, index * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), 0) ;
603 gHighGain->SetPoint(index, index * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(), 0) ;
608 if (in.GetModule() == EMCAL()->GetRawFormatLowGainOffset() )
609 lowGainFlag = kTRUE ;
611 lowGainFlag = kFALSE ;
614 gLowGain->SetPoint(in.GetTime(),
615 in.GetTime()* EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(),
618 gHighGain->SetPoint(in.GetTime(),
619 in.GetTime() * EMCAL()->GetRawFormatTimeMax() / EMCAL()->GetRawFormatTimeBins(),
622 } // EMCAL entries loop
626 delete gLowGain, gHighGain ;
628 return Digits()->GetEntriesFast() ;
631 //____________________________________________________________________________
632 Int_t AliEMCALGetter::ReadTreeD()
636 EmcalLoader()->CleanDigits() ;
637 // gets TreeD from the root file (EMCAL.Digits.root)
638 //if ( !IsLoaded("D") ) {
639 EmcalLoader()->LoadDigits("UPDATE") ;
640 EmcalLoader()->LoadDigitizer("UPDATE") ;
643 return Digits()->GetEntries() ;
646 //____________________________________________________________________________
647 Int_t AliEMCALGetter::ReadTreeH()
650 EmcalLoader()->CleanHits() ;
651 // gets TreeH from the root file (EMCAL.Hit.root)
652 //if ( !IsLoaded("H") ) {
653 EmcalLoader()->LoadHits("READ") ;
656 return Hits()->GetEntries() ;
659 //____________________________________________________________________________
660 Int_t AliEMCALGetter::ReadTreeR()
662 // Read the RecPoints
664 EmcalLoader()->CleanRecPoints() ;
665 // gets TreeR from the root file (EMCAL.RecPoints.root)
666 //if ( !IsLoaded("R") ) {
667 EmcalLoader()->LoadRecPoints("UPDATE") ;
668 EmcalLoader()->LoadClusterizer("UPDATE") ;
672 return ECARecPoints()->GetEntries() ;
675 //____________________________________________________________________________
676 Int_t AliEMCALGetter::ReadTreeT()
678 // Read the TrackSegments
680 EmcalLoader()->CleanTracks() ;
681 // gets TreeT from the root file (EMCAL.TrackSegments.root)
682 //if ( !IsLoaded("T") ) {
683 EmcalLoader()->LoadTracks("UPDATE") ;
684 EmcalLoader()->LoadTrackSegmentMaker("UPDATE") ;
688 return TrackSegments()->GetEntries() ;
690 //____________________________________________________________________________
691 Int_t AliEMCALGetter::ReadTreeP()
693 // Read the RecParticles
695 EmcalLoader()->CleanRecParticles() ;
696 // gets TreeP from the root file (EMCAL.RecParticles.root)
697 // if ( !IsLoaded("P") ) {
698 EmcalLoader()->LoadRecParticles("UPDATE") ;
699 EmcalLoader()->LoadPID("UPDATE") ;
703 return RecParticles()->GetEntries() ;
705 //____________________________________________________________________________
706 Int_t AliEMCALGetter::ReadTreeS()
710 // EmcalLoader()->CleanSDigits() ;
711 // gets TreeS from the root file (EMCAL.SDigits.root)
712 // if ( !IsLoaded("S") ) {
713 EmcalLoader()->LoadSDigits("READ") ;
714 EmcalLoader()->LoadSDigitizer("READ") ;
718 return SDigits()->GetEntries() ;
721 //____________________________________________________________________________
722 TClonesArray * AliEMCALGetter::SDigits() const
724 // asks the Loader to return the Digits container
726 TClonesArray * rv = 0 ;
728 rv = EmcalLoader()->SDigits() ;
730 EmcalLoader()->MakeSDigitsArray() ;
731 rv = EmcalLoader()->SDigits() ;
736 //____________________________________________________________________________
737 AliEMCALSDigitizer * AliEMCALGetter::SDigitizer()
739 // Return pointer to SDigitizer task
740 AliEMCALSDigitizer * rv ;
741 rv = dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
744 rv = dynamic_cast<AliEMCALSDigitizer *>(EmcalLoader()->SDigitizer()) ;
749 //____________________________________________________________________________
750 TParticle * AliEMCALGetter::Secondary(const TParticle* p, Int_t index) const
752 // Return first (index=1) or second (index=2) secondary particle of primary particle p
760 Int_t daughterIndex = p->GetDaughter(index-1) ;
761 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
762 return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ;
768 //____________________________________________________________________________
769 void AliEMCALGetter::Track(Int_t itrack)
771 // Read the first entry of EMCAL branch in hit tree gAlice->TreeH()
773 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
775 if( !TreeH() ) // load treeH the first time
778 // first time create the container
779 TClonesArray * hits = Hits() ;
783 TBranch * emcalbranch = dynamic_cast<TBranch*>(TreeH()->GetBranch("EMCAL")) ;
784 emcalbranch->SetAddress(&hits) ;
785 emcalbranch->GetEntry(itrack) ;
788 //____________________________________________________________________________
789 TTree * AliEMCALGetter::TreeD() const
791 // return pointer to Digits Tree
793 rv = EmcalLoader()->TreeD() ;
795 EmcalLoader()->MakeTree("D");
796 rv = EmcalLoader()->TreeD() ;
802 //____________________________________________________________________________
803 TTree * AliEMCALGetter::TreeH() const
805 // return pointer to Hits Tree
807 rv = EmcalLoader()->TreeH() ;
809 EmcalLoader()->MakeTree("H");
810 rv = EmcalLoader()->TreeH() ;
816 //____________________________________________________________________________
817 TTree * AliEMCALGetter::TreeR() const
819 // return pointer to RecPoints Tree
822 rv = EmcalLoader()->TreeR() ;
824 EmcalLoader()->MakeTree("R");
825 rv = EmcalLoader()->TreeR() ;
831 //____________________________________________________________________________
832 TTree * AliEMCALGetter::TreeT() const
834 // return pointer to TrackSegments Tree
836 rv = EmcalLoader()->TreeT() ;
838 EmcalLoader()->MakeTree("T");
839 rv = EmcalLoader()->TreeT() ;
844 //____________________________________________________________________________
845 TTree * AliEMCALGetter::TreeP() const
847 // return pointer to RecParticles Tree
849 rv = EmcalLoader()->TreeP() ;
851 EmcalLoader()->MakeTree("P");
852 rv = EmcalLoader()->TreeP() ;
858 //____________________________________________________________________________
859 TTree * AliEMCALGetter::TreeS() const
861 // return pointer to SDigits Tree
863 rv = EmcalLoader()->TreeS() ;
865 EmcalLoader()->MakeTree("S");
866 rv = EmcalLoader()->TreeS() ;
872 //____________________________________________________________________________
873 Bool_t AliEMCALGetter::VersionExists(TString & opt) const
875 // checks if the version with the present name already exists in the same directory
879 AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle());
880 TString version( rl->GetEventFolder()->GetName() ) ;
884 if ( opt == "sdigits") {
885 // add the version name to the root file name
886 TString fileName( EmcalLoader()->GetSDigitsFileName() ) ;
887 if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
888 fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
889 if ( !(gSystem->AccessPathName(fileName)) ) {
890 Warning("VersionExists", "The file %s already exists", fileName.Data()) ;
893 EmcalLoader()->SetSDigitsFileName(fileName) ;
896 if ( opt == "digits") {
897 // add the version name to the root file name
898 TString fileName( EmcalLoader()->GetDigitsFileName() ) ;
899 if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
900 fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
901 if ( !(gSystem->AccessPathName(fileName)) ) {
902 Warning("VersionExists", "The file %s already exists", fileName.Data()) ;
911 //____________________________________________________________________________
912 UShort_t AliEMCALGetter::EventPattern(void) const
914 // Return the pattern (trigger bit register) of the beam-test event
916 // return fBTE->GetPattern() ;
920 //____________________________________________________________________________
921 Float_t AliEMCALGetter::BeamEnergy(void) const
923 // Return the beam energy of the beam-test event
925 // return fBTE->GetBeamEnergy() ;