// --- ROOT system ---
-#include "TClonesArray.h"
-#include "TFolder.h"
-#include "TTree.h"
-#include "TFile.h"
-class TString ;
+#include "TObject.h"
class TParticle ;
-class TTask ;
+class TTree ;
// --- Standard library ---
-#include <stdlib.h>
-#include <iostream.h>
// --- AliRoot header files ---
-
-#include "AliRun.h"
-#include "AliPHOS.h"
+#include "AliConfig.h"
+#include "AliPHOSLoader.h"
#include "AliPHOSHit.h"
#include "AliPHOSDigit.h"
-#include "AliPHOSEmcRecPoint.h"
-#include "AliPHOSCpvRecPoint.h"
-#include "AliPHOSTrackSegment.h"
-#include "AliPHOSRecParticle.h"
+#include "AliPHOSEmcRecPoint.h"
+#include "AliPHOSCpvRecPoint.h"
+#include "AliPHOSTrackSegment.h"
+#include "AliPHOSRecParticle.h"
+#include "AliPHOSDigitizer.h"
+#include "AliPHOSSDigitizer.h"
+class AliPHOS ;
class AliPHOSGeometry ;
-class AliPHOSDigitizer ;
-class AliPHOSSDigitizer ;
class AliPHOSClusterizer ;
-class AliPHOSTrackSegmentMaker ;
-class AliPHOSPID ;
+class AliPHOSTrackSegmentMaker ;
+class AliPHOSPID ;
+class AliPHOSBeamTestEvent ;
+class AliESD ;
class AliPHOSGetter : public TObject {
- public:
-
+public:
AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public
- cerr << "ERROR: AliPHOGetter is a singleton default ctor not callable" << endl ;
- abort() ;
+ Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ;
}
- AliPHOSGetter(const AliPHOSGetter & obj) {
+ AliPHOSGetter(const AliPHOSGetter & obj) : TObject(obj) {
// cpy ctor requested by Coding Convention
- // but not yet needed
- abort() ;
+ Fatal("cpy ctor", "not implemented") ;
}
+ AliPHOSGetter & operator = (const AliPHOSGetter & ) {
+ // assignement operator requested by coding convention, but not needed
+ Fatal("operator =", "not implemented") ;
+ return *this ;
+ }
virtual ~AliPHOSGetter() ;
- void CloseFile() ;
- const TFolder * Folder(const TString what) const ;
- void ListBranches(Int_t event=0) const ;
- void NewBranch(TString name, Int_t event = 0) ;
- Bool_t NewFile(TString name) ;
- const Bool_t HasFailed() const { return fFailed ; }
- Bool_t PostPrimaries(void ) const ;
- Bool_t PostHits(void ) const ;
- Bool_t PostSDigits( const char * name, const char * file = 0) const ;
- Bool_t PostDigits( const char * name ) const ;
- Bool_t PostRecPoints( const char * name ) const ;
- Bool_t PostTrackSegments(const char * name) const ;
- Bool_t PostRecParticles( const char * name) const ;
-
- Bool_t PostClusterizer( const char * name) const ;
- Bool_t PostClusterizer(AliPHOSClusterizer * clu) const ;
- Bool_t PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const ;
- Bool_t PostSDigitizer ( const char * name, const char * file ) const ;
- Bool_t PostDigitizer (AliPHOSDigitizer * digitizer) const ;
- Bool_t PostDigitizer ( const char * name) const ;
- Bool_t PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tsm) const ;
- Bool_t PostTrackSegmentMaker(const char * name ) const ;
- Bool_t PostPID (AliPHOSPID * pid) const ;
- Bool_t PostPID (const char * name ) const ;
- Bool_t PostQA (void) const ;
+ //=========== Instantiators ================
+ static AliPHOSGetter * Instance(const char* headerFile,
+ const char* version = AliConfig::GetDefaultEventFolderName(),
+ Option_t * openingOption = "READ" ) ;
+ static AliPHOSGetter * Instance() ;
-
- void Event(const Int_t event, const char * opt = "HSDRP") ;
- void Track(Int_t itrack) ;
-
- //Method to be used when digitizing under AliRunDigitizer, who opens all files etc.
- void ReadTreeS(TTree * treeS,Int_t input) ;
+ static void Print() ;
- Int_t EventNumber() { return (Int_t) gAlice->GetEvNumber() ; }
- Int_t MaxEvent() { return (Int_t) gAlice->TreeE()->GetEntries() ; }
- static AliPHOSGetter * GetInstance(const char* headerFile,
- const char* branchTitle = "Default" ) ;
- static AliPHOSGetter * GetInstance() ;
-
- const AliPHOS * PHOS() ;
- const AliPHOSGeometry * PHOSGeometry() ;
- // Alarms
- TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)) ; }
- TObjArray * Alarms(const char * name ) const { return (TObjArray*)(ReturnO("Alarms", name)) ; }
-
- // QA Tasks
- TTask * QATasks(const char * name = 0) const { return (TTask*)(ReturnT("QATasks", name)) ; }
-
- // Primaries
- TClonesArray * Primaries(void) const { return (TClonesArray*)(ReturnO("Primaries")) ; }
- // Hits
- const TClonesArray * Hits(void) { return static_cast<const TClonesArray*>(ReturnO("Hits")) ; }
- const AliPHOSHit * Hit(Int_t index) { return static_cast<const AliPHOSHit*>(Hits()->At(index) );}
+ //=========== General information about run ==============
+ Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; }
+ void SetLoaded(TString tree) { fLoadingStatus += tree ; }
- // SDigits
- TClonesArray * SDigits(const char * name = 0, const char * file=0) {
- return static_cast<TClonesArray*>(ReturnO("SDigits", name, file)) ;
- }
- const AliPHOSDigit * SDigit(Int_t index) { return static_cast<const AliPHOSDigit*>(SDigits()->At(index)) ;}
+ Int_t MaxEvent() const ;
+ Int_t EventNumber() const ;
+ Bool_t VersionExists(TString & opt) const ;
+ UShort_t EventPattern(void) const ;
+ Float_t BeamEnergy(void) const ;
- AliPHOSSDigitizer * SDigitizer(const char * name =0) const {
- return ((AliPHOSSDigitizer*)(ReturnT("SDigitizer", name))) ;
- }
+ //========== PHOSGeometry and PHOS =============
+ AliPHOS * PHOS() const ;
+ AliPHOSGeometry * PHOSGeometry() const ;
- // Digits
- TClonesArray * Digits(const char * name = 0)const {
- return static_cast<TClonesArray*>(ReturnO("Digits", name)) ;
- }
- const AliPHOSDigit * Digit(Int_t index) { return static_cast<const AliPHOSDigit *>(Digits()->At(index)) ;}
- AliPHOSDigitizer * Digitizer(const char * name =0) const {
- return (AliPHOSDigitizer*)(ReturnT("Digitizer", name)) ;
- }
+ //========== Methods to read something from file ==========
+ void Event(Int_t event, const char * opt = "HSDRTP") ;
+ void Track(Int_t itrack) ;
- // RecPoints
- TObjArray * EmcRecPoints(const char * name = 0) {
- return static_cast<TObjArray*>(ReturnO("EmcRecPoints", name)) ;
- }
- TObjArray * CpvRecPoints(const char * name = 0) {
- return static_cast<TObjArray*>(ReturnO("CpvRecPoints", name)) ;
- }
- const AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) {
- return static_cast<const AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;
- }
- const AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) {
- return static_cast<const AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;
- }
-
- AliPHOSClusterizer * Clusterizer (const char * name =0) const {
- return (AliPHOSClusterizer*)(ReturnT("Clusterizer", name)) ;
- }
+ //-----------------now getter's data--------------------------------------
+ // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; }
+ // void ReadCalibrationDB(const char * name, const char * filename) ;
+
+ //=========== Primaries ============
+ TClonesArray * Primaries(void) ;
+ TParticle * Primary(Int_t index) const ;
+ Int_t NPrimaries()const { return fNPrimaries; }
+ TParticle * Secondary(const TParticle * p, Int_t index=1) const ;
+
+ //=========== Hits =================
+ TClonesArray * Hits(void) ;
+ AliPHOSHit * Hit(Int_t index) { return dynamic_cast<AliPHOSHit*>(Hits()->At(index) );}
+ TTree * TreeH() const ;
+
+ //=========== SDigits ==============
+ TClonesArray * SDigits() ;
+ AliPHOSDigit * SDigit(Int_t index) { return static_cast<AliPHOSDigit *>(SDigits()->At(index)) ;}
+ TTree * TreeS() const ;
+ AliPHOSSDigitizer * SDigitizer() ;
+
+ TString GetSDigitsFileName() const { return PhosLoader()->GetSDigitsFileName() ; }
+ Int_t LoadSDigits(Option_t* opt="") const { return PhosLoader()->LoadSDigits(opt) ; }
+ Int_t LoadSDigitizer(Option_t* opt="") const { return PhosLoader()->LoadSDigitizer(opt) ; }
+ Int_t WriteSDigits(Option_t* opt="") const { return PhosLoader()->WriteSDigits(opt) ; }
+ Int_t WriteSDigitizer(Option_t* opt="") const {
+ return PhosLoader()->WriteSDigitizer(opt) ; }
+
+ //========== Digits ================
+ TClonesArray * Digits() ;
+ AliPHOSDigit * Digit(Int_t index) { return static_cast<AliPHOSDigit *>(Digits()->At(index)) ;}
+ TTree * TreeD() const ;
+ AliPHOSDigitizer * Digitizer() ;
+ TString GetDigitsFileName() const { return PhosLoader()->GetDigitsFileName() ; }
+ Int_t LoadDigits(Option_t* opt="") const { return PhosLoader()->LoadDigits(opt) ; }
+ Int_t LoadDigitizer(Option_t* opt="") const {
+ return PhosLoader()->LoadDigitizer(opt) ; }
+ Int_t WriteDigits(Option_t* opt="") const { return PhosLoader()->WriteDigits(opt) ; }
+ Int_t WriteDigitizer(Option_t* opt="") const {
+ return PhosLoader()->WriteDigitizer(opt) ; }
+
+ //========== RecPoints =============
+ TObjArray * EmcRecPoints() ;
+ AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) { return static_cast<AliPHOSEmcRecPoint *>(EmcRecPoints()->At(index)) ;}
+ TObjArray * CpvRecPoints() ;
+ AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) { return static_cast<AliPHOSCpvRecPoint *>(CpvRecPoints()->At(index)) ;}
+ TTree * TreeR() const ;
+ AliPHOSClusterizer * Clusterizer() ;
+ TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; }
+ Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; }
+ Int_t LoadClusterizer(Option_t* opt="") const {
+ return PhosLoader()->LoadClusterizer(opt) ; }
+ Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; }
+ Int_t WriteClusterizer(Option_t* opt="") const {
+ return PhosLoader()->WriteClusterizer(opt) ; }
+
+ //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) {
+ TClonesArray * TrackSegments() ;
+ AliPHOSTrackSegment * TrackSegment(Int_t index) { return static_cast<AliPHOSTrackSegment *>(TrackSegments()->At(index)) ;}
+ TTree * TreeT() const ;
+ AliPHOSTrackSegmentMaker * TrackSegmentMaker() ;
+ TString GetTracksFileName() const { return PhosLoader()->GetTracksFileName() ; }
+ Int_t LoadTracks(Option_t* opt="") const { return PhosLoader()->LoadTracks(opt) ; }
+ Int_t LoadTrackSegementMaker(Option_t* opt="") const {
+ return PhosLoader()->LoadTrackSegmentMaker(opt) ; }
+ Int_t WriteTracks(Option_t* opt="") const { return PhosLoader()->WriteTracks(opt) ; }
+ Int_t WriteTrackSegmentMaker(Option_t* opt="") const {
+ return PhosLoader()->WriteTracker(opt) ; }
+
+ //========== RecParticles ===========
+ TClonesArray * RecParticles() ;
+ AliPHOSRecParticle * RecParticle(Int_t index) { return static_cast<AliPHOSRecParticle *>(RecParticles()->At(index)) ;}
+ TTree * TreeP() const ;
+ AliPHOSPID * PID() ;
+ TString GetRecParticlesFileName() const { return PhosLoader()->GetRecParticlesFileName() ; }
+ Int_t LoadRecParticles(Option_t* opt="") const { return PhosLoader()->LoadRecParticles(opt) ; }
+ Int_t LoadPID(Option_t* opt="") const {
+ return PhosLoader()->LoadPID(opt) ; }
+ Int_t WriteRecParticles(Option_t* opt="") const { return PhosLoader()->WriteRecParticles(opt) ; }
+ Int_t WritePID(Option_t* opt="") const {
+ return PhosLoader()->WritePID(opt) ; }
+
+ void SetDebug(Int_t level) {fgDebug = level;} // Set debug level
+ void PostClusterizer(AliPHOSClusterizer * clu)
+ const{PhosLoader()->PostClusterizer(clu) ; }
+ void PostPID(AliPHOSPID * pid)
+ const{PhosLoader()->PostPID(pid) ; }
+ void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr)
+ const{PhosLoader()->PostTrackSegmentMaker(tr) ; }
+ void PostSDigitizer (AliPHOSSDigitizer * sdigitizer)
+ const {PhosLoader()->PostSDigitizer(sdigitizer);}
+ void PostDigitizer (AliPHOSDigitizer * digitizer)
+ const {PhosLoader()->PostDigitizer(dynamic_cast<AliDigitizer *>(digitizer));}
+
+ TString Version() const { return PhosLoader()->GetTitle() ; }
+ AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; }
+ void Reset() ;
+
+ AliESD * ESD(Int_t event = 0) ;
+ Bool_t OpenESDFile() ;
- // TrackSegments
- TClonesArray * TrackSegments(const char * name = 0) {
- return static_cast<TClonesArray*>(ReturnO("TrackSegments", name)) ;
- }
- const AliPHOSTrackSegment * TrackSegment(Int_t index) {
- return static_cast<const AliPHOSTrackSegment*>(TrackSegments()->At(index)) ;
- }
- AliPHOSTrackSegmentMaker * TrackSegmentMaker (const char * name =0) const {
- return (AliPHOSTrackSegmentMaker*)(ReturnT("TrackSegmentMaker", name)) ;
- }
-
- // RecParticles
- TClonesArray * RecParticles(const char * name = 0) {
- return static_cast<TClonesArray*>(ReturnO("RecParticles", name)) ;
- }
- const AliPHOSRecParticle * RecParticle(Int_t index) {
- return static_cast<const AliPHOSRecParticle*>(RecParticles()->At(index)) ;
- }
- AliPHOSPID * PID(const char * name =0) const {
- return (AliPHOSPID*)(ReturnT("PID", name)) ;
- }
+private:
- // Primaries
- const TParticle * Primary(Int_t index) const ;
- const Int_t NPrimaries()const { return fNPrimaries; }
- const TParticle * Secondary(TParticle * p, Int_t index=1) const ;
+ AliPHOSGetter(const char* headerFile,
+ const char* version = AliConfig::GetDefaultEventFolderName(),
+ Option_t * openingOption = "READ") ;
- void RemoveTask(TString opt, TString name) const ;
- void RemoveObjects(TString opt, TString name) const ;
- void RemoveSDigits() const ;
- void SetDebug(Int_t level) {fDebug = level;} // Set debug level
+ Int_t ReadTreeD(void) ;
+ Int_t ReadTreeH(void) ;
+ Int_t ReadTreeR(void) ;
+ Int_t ReadTreeT(void) ;
+ Int_t ReadTreeS(void) ;
+ Int_t ReadTreeP(void) ;
+
+ void ReadPrimaries(void) ;
- AliPHOSGetter & operator = (const AliPHOSGetter & ) {
- // assignement operator requested by coding convention, but not needed
- abort() ;
- return *this ;
- }
+private:
- TFolder * SDigitsFolder() { return dynamic_cast<TFolder*>(fSDigitsFolder->FindObject("PHOS")) ; }
-
- void SetRecParticlesTitle(const TString title) { fRecParticlesTitle = title ; }
+ AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event
+ static Int_t fgDebug ; //! Debug level
-private:
+ TString fLoadingStatus ; //! tells which trees are loaded
+ Int_t fNPrimaries ; //! # of primaries
+ TClonesArray * fPrimaries ; //! list of lists of primaries
+ TFile * fESDFile ; //! ESD file
+ TString fESDFileName ; //! ESD File Name
- AliPHOSGetter(const char* headerFile, const char* branchTitle ="Default") ;
- TObject * ReturnO(TString what, TString name=0, TString file=0) const ;
- const TTask * ReturnT(TString what,TString name=0) const ;
- void DefineBranchTitles(char* branch, char* branchTitle) ;
- Int_t ReadTreeD() ;
- Int_t ReadTreeH() ;
- Int_t ReadTreeR(Bool_t any=kFALSE) ;
- Int_t ReadTreeS(Int_t event) ;
- void ReadTreeQA() ;
- void ReadPrimaries() ;
-
- TObject** PrimariesRef(void) const ;
- TObject** HitsRef(void) const ;
- TObject** SDigitsRef(const char * name, const char * file = 0 ) const;
- TObject** DigitsRef (const char * name) const ;
- TObject** EmcRecPointsRef (const char * name) const ;
- TObject** CpvRecPointsRef (const char * name) const ;
- TObject** TrackSegmentsRef(const char * name) const ;
- TObject** RecParticlesRef (const char * name) const ;
- TObject** AlarmsRef (void) const ;
-
- TObject** SDigitizerRef (const char * name) const ;
- TObject** DigitizerRef (const char * name) const ;
- TObject** ClusterizerRef(const char * name) const ;
- TObject** TSMakerRef (const char * name) const ;
- TObject** PIDRef (const char * name) const ;
-
- private:
-
- static TFile * fFile; //!
- TString fHeaderFile ; //! File in which gAlice lives
- TString fBranchTitle ; //!
- TString fTrackSegmentsTitle ;//!
- TString fRecPointsTitle ; //!
- TString fRecParticlesTitle ; //!
- TString fDigitsTitle ; //! TDirectory tempo(gDirectory) ;
-
- TString fSDigitsTitle ; //!
-
- Bool_t fFailed ; //! set if file not opend or galice not found
- Int_t fDebug ; // Debug level
-
- Int_t fNPrimaries ; //! # of primaries
+ // AliPHOSCalibrationDB * fcdb ; //!
- TObjArray * fPrimaries ; //! list of lists of primaries-for the case of mixing
-
- TFolder * fModuleFolder ; //!Folder that contains the modules
- TFolder * fPrimariesFolder ; //!Folder that contains the Primary Particles
- TFolder * fHitsFolder ; //!Folder that contains the Hits
- TFolder * fSDigitsFolder ; //!Folder that contains the SDigits
- TFolder * fDigitsFolder ; //!Folder that contains the Digits
- TFolder * fRecoFolder ; //!Folder that contains the reconstructed objects (RecPoints, TrackSegments, RecParticles)
- TFolder * fQAFolder ; //!Folder that contains the QA objects
- TFolder * fTasksFolder ; //!Folder that contains the Tasks (sdigitizer, digitizer, reconstructioner)
-
+ static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO
static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton
-
+
+ enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes};
+
+
ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index
-
-};
+
+ };
#endif // AliPHOSGETTER_H