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 AliPHOSAnalyser):
28 // AliPHOSGetter * gime = AliPHOSGetter::GetInstance("galice.root","test") ;
29 // for(Int_t irecp = 0; irecp < gime->NRecParticles() ; irecp++)
30 // AliPHOSRecParticle * 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 AliPHOSIndexToObject and make
38 //*-- systematic usage of TFolders without changing the interface
39 //////////////////////////////////////////////////////////////////////////////
41 // --- ROOT system ---
46 #include <TParticle.h>
51 // --- Standard library ---
53 // --- AliRoot header files ---
55 #include "AliHeader.h"
58 #include "AliPHOSBeamTestEvent.h"
59 #include "AliPHOSGetter.h"
60 #include "AliPHOSLoader.h"
61 #include "AliRunLoader.h"
63 #include "AliPHOSRawStream.h"
64 #include "AliRawReaderFile.h"
67 ClassImp(AliPHOSGetter)
69 AliPHOSGetter * AliPHOSGetter::fgObjGetter = 0 ;
70 AliPHOSLoader * AliPHOSGetter::fgPhosLoader = 0;
71 Int_t AliPHOSGetter::fgDebug = 0;
73 // TFile * AliPHOSGetter::fgFile = 0 ;
75 //____________________________________________________________________________
76 AliPHOSGetter::AliPHOSGetter(const char* headerFile, const char* version, Option_t * openingOption)
78 // ctor only called by Instance()
80 AliRunLoader* rl = AliRunLoader::GetRunLoader(version) ;
82 rl = AliRunLoader::Open(headerFile, version, openingOption);
84 Fatal("AliPHOSGetter", "Could not find the Run Loader for %s - %s",headerFile, version) ;
87 if (rl->GetAliRun() == 0x0) {
89 gAlice = rl->GetAliRun(); // should be removed
92 fgPhosLoader = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
94 Error("AliPHOSGetter", "Could not find PHOSLoader") ;
96 fgPhosLoader->SetTitle(version);
99 // initialize data members
103 fLoadingStatus = "" ;
105 fESDFileName = rl->GetFileName() ; // this should be the galice.root file
106 fESDFileName.ReplaceAll("galice.root", "AliESDs.root") ;
112 //____________________________________________________________________________
113 AliPHOSGetter::~AliPHOSGetter()
116 delete fgPhosLoader ;
120 fPrimaries->Delete() ;
129 //____________________________________________________________________________
130 void AliPHOSGetter::Reset()
132 // resets things in case the getter is called consecutively with different files
133 // the PHOS Loader is already deleted by the Run Loader
136 fPrimaries->Delete() ;
143 //____________________________________________________________________________
144 AliPHOSClusterizer * AliPHOSGetter::Clusterizer()
146 // Returns pointer to the Clusterizer task
147 AliPHOSClusterizer * rv ;
148 rv = dynamic_cast<AliPHOSClusterizer *>(PhosLoader()->Reconstructioner()) ;
151 rv = dynamic_cast<AliPHOSClusterizer*>(PhosLoader()->Reconstructioner()) ;
156 //____________________________________________________________________________
157 TObjArray * AliPHOSGetter::CpvRecPoints()
159 // asks the Loader to return the CPV RecPoints container
163 rv = PhosLoader()->CpvRecPoints() ;
165 PhosLoader()->MakeRecPointsArray() ;
166 rv = PhosLoader()->CpvRecPoints() ;
171 //____________________________________________________________________________
172 TClonesArray * AliPHOSGetter::Digits()
174 // asks the Loader to return the Digits container
176 TClonesArray * rv = 0 ;
177 rv = PhosLoader()->Digits() ;
180 PhosLoader()->MakeDigitsArray() ;
181 rv = PhosLoader()->Digits() ;
186 //____________________________________________________________________________
187 AliPHOSDigitizer * AliPHOSGetter::Digitizer()
189 // Returns pointer to the Digitizer task
190 AliPHOSDigitizer * rv ;
191 rv = dynamic_cast<AliPHOSDigitizer *>(PhosLoader()->Digitizer()) ;
194 rv = dynamic_cast<AliPHOSDigitizer *>(PhosLoader()->Digitizer()) ;
200 //____________________________________________________________________________
201 TObjArray * AliPHOSGetter::EmcRecPoints()
203 // asks the Loader to return the EMC RecPoints container
207 rv = PhosLoader()->EmcRecPoints() ;
209 PhosLoader()->MakeRecPointsArray() ;
210 rv = PhosLoader()->EmcRecPoints() ;
215 //____________________________________________________________________________
216 TClonesArray * AliPHOSGetter::TrackSegments()
218 // asks the Loader to return the TrackSegments container
220 TClonesArray * rv = 0 ;
222 rv = PhosLoader()->TrackSegments() ;
224 PhosLoader()->MakeTrackSegmentsArray() ;
225 rv = PhosLoader()->TrackSegments() ;
230 //____________________________________________________________________________
231 AliPHOSTrackSegmentMaker * AliPHOSGetter::TrackSegmentMaker()
233 // Returns pointer to the TrackSegmentMaker task
234 AliPHOSTrackSegmentMaker * rv ;
235 rv = dynamic_cast<AliPHOSTrackSegmentMaker *>(PhosLoader()->TrackSegmentMaker()) ;
238 rv = dynamic_cast<AliPHOSTrackSegmentMaker *>(PhosLoader()->TrackSegmentMaker()) ;
243 //____________________________________________________________________________
244 TClonesArray * AliPHOSGetter::RecParticles()
246 // asks the Loader to return the TrackSegments container
248 TClonesArray * rv = 0 ;
250 rv = PhosLoader()->RecParticles() ;
252 PhosLoader()->MakeRecParticlesArray() ;
253 rv = PhosLoader()->RecParticles() ;
257 //____________________________________________________________________________
258 void AliPHOSGetter::Event(Int_t event, const char* opt)
260 // Reads the content of all Tree's S, D and R
262 if ( event >= MaxEvent() ) {
263 Error("Event", "%d not found in TreeE !", event) ;
267 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
269 // checks if we are dealing with test-beam data
270 TBranch * btb = rl->TreeE()->GetBranch("AliPHOSBeamTestEvent") ;
273 fBTE = new AliPHOSBeamTestEvent() ;
274 btb->SetAddress(&fBTE) ;
275 btb->GetEntry(event) ;
284 // Loads the type of object(s) requested
286 rl->GetEvent(event) ;
288 if( strstr(opt,"X") || (strcmp(opt,"")==0) )
297 if( strstr(opt,"D") )
300 if( strstr(opt,"R") )
303 if( strstr(opt,"T") )
306 if( strstr(opt,"P") )
309 if( strstr(opt,"E") )
312 if( strstr(opt,"W") )
316 // if( strstr(opt,"Q") )
322 //____________________________________________________________________________
323 Int_t AliPHOSGetter::EventNumber() const
325 // return the current event number
326 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
327 return static_cast<Int_t>(rl->GetEventNumber()) ;
330 //____________________________________________________________________________
331 TClonesArray * AliPHOSGetter::Hits()
333 // asks the loader to return the Hits container
335 TClonesArray * rv = 0 ;
337 rv = PhosLoader()->Hits() ;
339 PhosLoader()->LoadHits("read");
340 rv = PhosLoader()->Hits() ;
345 //____________________________________________________________________________
346 AliPHOSGetter * AliPHOSGetter::Instance(const char* alirunFileName, const char* version, Option_t * openingOption)
348 // Creates and returns the pointer of the unique instance
349 // Must be called only when the environment has changed
351 //::Info("Instance","alirunFileName=%s version=%s openingOption=%s",alirunFileName,version,openingOption);
353 if(!fgObjGetter){ // first time the getter is called
354 fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ;
356 else { // the getter has been called previously
357 AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle());
358 if ( rl->GetFileName() == alirunFileName ) {// the alirunFile has the same name
359 // check if the file is already open
360 TFile * galiceFile = dynamic_cast<TFile *>(gROOT->FindObject(rl->GetFileName()) ) ;
363 fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ;
365 else { // the file is already open check the version name
366 TString currentVersionName = rl->GetEventFolder()->GetName() ;
367 TString newVersionName(version) ;
368 if (currentVersionName == newVersionName)
370 ::Warning( "Instance", "Files with version %s already open", currentVersionName.Data() ) ;
372 fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ;
377 AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle()) ;
378 if ( strstr(version, AliConfig::GetDefaultEventFolderName()) ) // false in case of merging
380 fgObjGetter = new AliPHOSGetter(alirunFileName, version, openingOption) ;
384 ::Error("AliPHOSGetter::Instance", "Failed to create the PHOS Getter object") ;
392 //____________________________________________________________________________
393 AliPHOSGetter * AliPHOSGetter::Instance()
395 // Returns the pointer of the unique instance already defined
397 if(!fgObjGetter && fgDebug)
398 ::Warning("AliPHOSGetter::Instance", "Getter not initialized") ;
404 //____________________________________________________________________________
405 Int_t AliPHOSGetter::MaxEvent() const
407 // returns the number of events in the run (from TE)
409 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
410 return static_cast<Int_t>(rl->GetNumberOfEvents()) ;
413 //____________________________________________________________________________
414 TParticle * AliPHOSGetter::Primary(Int_t index) const
416 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
417 return rl->Stack()->Particle(index) ;
420 //____________________________________________________________________________
421 AliPHOS * AliPHOSGetter:: PHOS() const
423 // returns the PHOS object
424 AliPHOS * phos = dynamic_cast<AliPHOS*>(PhosLoader()->GetModulesFolder()->FindObject("PHOS")) ;
427 Warning("PHOS", "PHOS module not found in module folders: %s", PhosLoader()->GetModulesFolder()->GetName() ) ;
433 //____________________________________________________________________________
434 AliPHOSPID * AliPHOSGetter::PID()
436 // Returns pointer to the PID task
438 rv = dynamic_cast<AliPHOSPID *>(PhosLoader()->PIDTask()) ;
441 rv = dynamic_cast<AliPHOSPID *>(PhosLoader()->PIDTask()) ;
446 //____________________________________________________________________________
447 AliPHOSGeometry * AliPHOSGetter::PHOSGeometry() const
449 // Returns PHOS geometry
451 AliPHOSGeometry * rv = 0 ;
453 rv = PHOS()->GetGeometry() ;
457 //____________________________________________________________________________
458 TClonesArray * AliPHOSGetter::Primaries()
460 // creates the Primaries container if needed
463 Info("Primaries", "Creating a new TClonesArray for primaries") ;
464 fPrimaries = new TClonesArray("TParticle", 1000) ;
469 //____________________________________________________________________________
470 void AliPHOSGetter::Print()
472 // Print usefull information about the getter
474 AliRunLoader * rl = AliRunLoader::GetRunLoader(fgPhosLoader->GetTitle());
475 ::Info( "Print", "gAlice file is %s -- version name is %s", (rl->GetFileName()).Data(), rl->GetEventFolder()->GetName() ) ;
478 //____________________________________________________________________________
479 void AliPHOSGetter::ReadPrimaries()
481 // Read Primaries from Kinematics.root
483 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
485 // gets kine tree from the root file (Kinematics.root)
486 if ( ! rl->TreeK() ) { // load treeK the first time
487 rl->LoadKinematics() ;
490 fNPrimaries = (rl->GetHeader())->GetNtrack();
492 Info( "ReadTreeK", "Found %d particles in event # %d", fNPrimaries, EventNumber() ) ;
495 // first time creates the container
497 fPrimaries->Clear() ;
500 for (index = 0 ; index < fNPrimaries; index++) {
501 new ((*fPrimaries)[index]) TParticle(*(Primary(index)));
505 //____________________________________________________________________________
506 Bool_t AliPHOSGetter::OpenESDFile()
511 fESDFile = TFile::Open(fESDFileName) ;
515 else if (fESDFile->IsOpen()) {
517 fESDFile = TFile::Open(fESDFileName) ;
519 if (!fESDFile->IsOpen())
525 //____________________________________________________________________________
526 void AliPHOSGetter::FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Int_t & amp, Double_t & time)
528 // Fits the raw signal time distribution
530 const Int_t kNoiseThreshold = 0 ;
531 Double_t timezero1 = 0., timezero2 = 0., timemax = 0. ;
532 Double_t signal = 0., signalmax = 0. ;
533 Double_t energy = time = 0. ;
537 for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) {
538 gLowGain->GetPoint(index, time, signal) ;
539 if (signal > kNoiseThreshold && timezero1 == 0.)
541 if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.)
543 if (signal > signalmax) {
548 signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatLowCharge(),
549 PHOS()->GetRawFormatLowGain()) ;
550 if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise
551 signalF->SetParameter(2, signalmax) ;
552 signalF->SetParameter(3, timezero1) ;
553 gLowGain->Fit(signalF, "QRON", "", 0., timezero2); //, "QRON") ;
554 energy = signalF->GetParameter(2) ;
555 time = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ;
558 timezero1 = timezero2 = signalmax = timemax = 0. ;
559 signalF->FixParameter(0, PHOS()->GetRawFormatHighCharge()) ;
560 signalF->FixParameter(1, PHOS()->GetRawFormatHighGain()) ;
562 for (index = 0; index < PHOS()->GetRawFormatTimeBins(); index++) {
563 gHighGain->GetPoint(index, time, signal) ;
564 if (signal > kNoiseThreshold && timezero1 == 0.)
566 if (signal <= kNoiseThreshold && timezero1 > 0. && timezero2 == 0.)
568 if (signal > signalmax) {
573 signalmax /= PHOS()->RawResponseFunctionMax(PHOS()->GetRawFormatHighCharge(),
574 PHOS()->GetRawFormatHighGain()) ;;
575 if ( timezero1 + PHOS()->GetRawFormatTimePeak() < PHOS()->GetRawFormatTimeMax() * 0.4 ) { // else its noise
576 signalF->SetParameter(2, signalmax) ;
577 signalF->SetParameter(3, timezero1) ;
578 gHighGain->Fit(signalF, "QRON", "", 0., timezero2) ;
579 energy = signalF->GetParameter(2) ;
580 time = signalF->GetMaximumX() - PHOS()->GetRawFormatTimePeak() - PHOS()->GetRawFormatTimeTrigger() ;
584 if (time == 0. && energy == 0.)
587 AliPHOSDigitizer * digitizer = Digitizer() ;
588 amp = static_cast<Int_t>( (energy - digitizer->GetEMCpedestal()) / digitizer->GetEMCchannel() + 0.5 ) ;
592 //____________________________________________________________________________
593 Int_t AliPHOSGetter::ReadRaw(Int_t event)
595 // reads the raw format data, converts it into digits format and store digits in Digits()
598 AliRawReaderFile rawReader(event) ;
599 AliPHOSRawStream in(&rawReader);
601 Bool_t first = kTRUE ;
603 TGraph * gLowGain = new TGraph(PHOS()->GetRawFormatTimeBins()) ;
604 TGraph * gHighGain = new TGraph(PHOS()->GetRawFormatTimeBins()) ;
606 TF1 * signalF = new TF1("signal", AliPHOS::RawResponseFunction, 0, PHOS()->GetRawFormatTimeMax(), 4);
607 signalF->SetParNames("Charge", "Gain", "Amplitude", "TimeZero") ;
610 Bool_t lowGainFlag = kFALSE ;
612 TClonesArray * digits = Digits() ;
618 while ( in.Next() ) { // PHOS entries loop
619 if ( (in.IsNewRow() || in.IsNewColumn() || in.IsNewModule()) ) {
622 FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, amp, time) ;
624 new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ;
629 relId[0] = in.GetModule() ;
630 if ( relId[0] >= PHOS()->GetRawFormatLowGainOffset() ) {
631 relId[0] -= PHOS()->GetRawFormatLowGainOffset() ;
632 lowGainFlag = kTRUE ;
634 lowGainFlag = kFALSE ;
636 relId[2] = in.GetRow() ;
637 relId[3] = in.GetColumn() ;
638 PHOSGeometry()->RelToAbsNumbering(relId, id) ;
641 gLowGain->SetPoint(in.GetTime(),
645 gHighGain->SetPoint(in.GetTime(),
646 in.GetTime() * PHOS()->GetRawFormatTimeMax() / PHOS()->GetRawFormatTimeBins(),
649 } // PHOS entries loop
651 FitRaw(lowGainFlag, gLowGain, gHighGain, signalF, amp, time) ;
653 new((*digits)[idigit]) AliPHOSDigit( -1, id, amp, time) ;
658 delete gLowGain, gHighGain ;
660 return digits->GetEntriesFast() ;
663 //____________________________________________________________________________
664 Int_t AliPHOSGetter::ReadTreeD()
668 PhosLoader()->CleanDigits() ;
669 // gets TreeD from the root file (PHOS.Digits.root)
670 // if ( !IsLoaded("D") ) {
671 PhosLoader()->LoadDigits("UPDATE") ;
672 PhosLoader()->LoadDigitizer("UPDATE") ;
675 return Digits()->GetEntries() ;
678 //____________________________________________________________________________
679 Int_t AliPHOSGetter::ReadTreeH()
682 PhosLoader()->CleanHits() ;
683 // gets TreeH from the root file (PHOS.Hit.root)
684 //if ( !IsLoaded("H") ) {
685 PhosLoader()->LoadHits("UPDATE") ;
688 return Hits()->GetEntries() ;
691 //____________________________________________________________________________
692 Int_t AliPHOSGetter::ReadTreeR()
694 // Read the RecPoints
696 PhosLoader()->CleanRecPoints() ;
697 // gets TreeR from the root file (PHOS.RecPoints.root)
698 //if ( !IsLoaded("R") ) {
699 PhosLoader()->LoadRecPoints("UPDATE") ;
700 PhosLoader()->LoadClusterizer("UPDATE") ;
704 return EmcRecPoints()->GetEntries() ;
707 //____________________________________________________________________________
708 Int_t AliPHOSGetter::ReadTreeT()
710 // Read the TrackSegments
712 PhosLoader()->CleanTracks() ;
713 // gets TreeT from the root file (PHOS.TrackSegments.root)
714 //if ( !IsLoaded("T") ) {
715 PhosLoader()->LoadTracks("UPDATE") ;
716 PhosLoader()->LoadTrackSegmentMaker("UPDATE") ;
720 return TrackSegments()->GetEntries() ;
722 //____________________________________________________________________________
723 Int_t AliPHOSGetter::ReadTreeP()
725 // Read the RecParticles
727 PhosLoader()->CleanRecParticles() ;
729 // gets TreeT from the root file (PHOS.TrackSegments.root)
730 // if ( !IsLoaded("P") ) {
731 PhosLoader()->LoadRecParticles("UPDATE") ;
732 PhosLoader()->LoadPID("UPDATE") ;
736 return RecParticles()->GetEntries() ;
738 //____________________________________________________________________________
739 Int_t AliPHOSGetter::ReadTreeS()
743 PhosLoader()->CleanSDigits() ;
744 // gets TreeS from the root file (PHOS.SDigits.root)
745 //if ( !IsLoaded("S") ) {
746 PhosLoader()->LoadSDigits("READ") ;
747 PhosLoader()->LoadSDigitizer("READ") ;
751 return SDigits()->GetEntries() ;
754 //____________________________________________________________________________
755 Int_t AliPHOSGetter::ReadTreeE(Int_t event)
759 // gets esdTree from the root file (AliESDs.root)
761 if ( !OpenESDFile() )
764 fESDTree = static_cast<TTree*>(fESDFile->Get("esdTree")) ;
768 Error("ReadTreeE", "no ESD tree found");
771 fESDTree->SetBranchAddress("ESD", &fESD);
772 fESDTree->GetEvent(event);
777 //____________________________________________________________________________
778 TClonesArray * AliPHOSGetter::SDigits()
780 // asks the Loader to return the Digits container
782 TClonesArray * rv = 0 ;
784 rv = PhosLoader()->SDigits() ;
786 PhosLoader()->MakeSDigitsArray() ;
787 rv = PhosLoader()->SDigits() ;
792 //____________________________________________________________________________
793 AliPHOSSDigitizer * AliPHOSGetter::SDigitizer()
795 // Returns pointer to the SDigitizer task
796 AliPHOSSDigitizer * rv ;
797 rv = dynamic_cast<AliPHOSSDigitizer *>(PhosLoader()->SDigitizer()) ;
800 rv = dynamic_cast<AliPHOSSDigitizer *>(PhosLoader()->SDigitizer()) ;
805 //____________________________________________________________________________
806 TParticle * AliPHOSGetter::Secondary(const TParticle* p, Int_t index) const
808 // Return first (index=1) or second (index=2) secondary particle of primary particle p
816 Int_t daughterIndex = p->GetDaughter(index-1) ;
817 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
818 return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ;
824 //____________________________________________________________________________
825 void AliPHOSGetter::Track(Int_t itrack)
827 // Read the first entry of PHOS branch in hit tree gAlice->TreeH()
829 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
831 if( !TreeH() ) // load treeH the first time
834 // first time create the container
835 TClonesArray * hits = Hits() ;
839 TBranch * phosbranch = dynamic_cast<TBranch*>(TreeH()->GetBranch("PHOS")) ;
840 phosbranch->SetAddress(&hits) ;
841 phosbranch->GetEntry(itrack) ;
844 //____________________________________________________________________________
845 TTree * AliPHOSGetter::TreeD() const
847 // Returns pointer to the Digits Tree
849 rv = PhosLoader()->TreeD() ;
851 PhosLoader()->MakeTree("D");
852 rv = PhosLoader()->TreeD() ;
858 //____________________________________________________________________________
859 TTree * AliPHOSGetter::TreeH() const
861 // Returns pointer to the Hits Tree
863 rv = PhosLoader()->TreeH() ;
865 PhosLoader()->MakeTree("H");
866 rv = PhosLoader()->TreeH() ;
872 //____________________________________________________________________________
873 TTree * AliPHOSGetter::TreeR() const
875 // Returns pointer to the RecPoints Tree
877 rv = PhosLoader()->TreeR() ;
879 PhosLoader()->MakeTree("R");
880 rv = PhosLoader()->TreeR() ;
886 //____________________________________________________________________________
887 TTree * AliPHOSGetter::TreeT() const
889 // Returns pointer to the TrackSegments Tree
891 rv = PhosLoader()->TreeT() ;
893 PhosLoader()->MakeTree("T");
894 rv = PhosLoader()->TreeT() ;
899 //____________________________________________________________________________
900 TTree * AliPHOSGetter::TreeP() const
902 // Returns pointer to the RecParticles Tree
904 rv = PhosLoader()->TreeP() ;
906 PhosLoader()->MakeTree("P");
907 rv = PhosLoader()->TreeP() ;
913 //____________________________________________________________________________
914 TTree * AliPHOSGetter::TreeS() const
916 // Returns pointer to the SDigits Tree
918 rv = PhosLoader()->TreeS() ;
920 PhosLoader()->MakeTree("S");
921 rv = PhosLoader()->TreeS() ;
927 //____________________________________________________________________________
928 Bool_t AliPHOSGetter::VersionExists(TString & opt) const
930 // checks if the version with the present name already exists in the same directory
934 AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle());
935 TString version( rl->GetEventFolder()->GetName() ) ;
939 if ( opt == "sdigits") {
940 // add the version name to the root file name
941 TString fileName( PhosLoader()->GetSDigitsFileName() ) ;
942 if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
943 fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
944 if ( !(gSystem->AccessPathName(fileName)) ) {
945 Warning("VersionExists", "The file %s already exists", fileName.Data()) ;
948 PhosLoader()->SetSDigitsFileName(fileName) ;
951 if ( opt == "digits") {
952 // add the version name to the root file name
953 TString fileName( PhosLoader()->GetDigitsFileName() ) ;
954 if (version != AliConfig::GetDefaultEventFolderName()) // only if not the default folder name
955 fileName = fileName.ReplaceAll(".root", "") + "_" + version + ".root" ;
956 if ( !(gSystem->AccessPathName(fileName)) ) {
957 Warning("VersionExists", "The file %s already exists", fileName.Data()) ;
966 //____________________________________________________________________________
967 UShort_t AliPHOSGetter::EventPattern(void) const
969 // Return the pattern (trigger bit register) of the beam-test event
971 return fBTE->GetPattern() ;
975 //____________________________________________________________________________
976 Float_t AliPHOSGetter::BeamEnergy(void) const
978 // Return the beam energy of the beam-test event
980 return fBTE->GetBeamEnergy() ;