X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSGetter.h;h=030b7cb79ba12398faf1b7a1ceee05c67e620203;hb=0d528e1fa442a2961f9383292174956c61c89144;hp=a97e4632c26f47c1cb51a43e10bd4e9ecf89bd34;hpb=a8c47ab60ad997f04fe8b6319252c3e891625397;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSGetter.h b/PHOS/AliPHOSGetter.h index a97e4632c26..030b7cb79ba 100644 --- a/PHOS/AliPHOSGetter.h +++ b/PHOS/AliPHOSGetter.h @@ -18,43 +18,43 @@ // --- ROOT system --- #include "TObject.h" -#include "TClonesArray.h" -// #include "TFolder.h" -// #include "TTree.h" -// #include "TFile.h" -// class TString ; - class TParticle ; -// class TTask ; +class TParticle ; +class TTree ; +class TGraph ; +class TF1 ; // --- Standard library --- // --- AliRoot header files --- #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 "AliPHOSDigitizer.h" +#include "AliPHOSSDigitizer.h" +#include "AliPHOSCalibData.h" -// #include "AliRun.h" -class AliPHOS ; -#include "AliPHOSHit.h" - +class AliPHOS ; class AliPHOSGeometry ; -#include "AliPHOSDigitizer.h" -#include "AliPHOSSDigitizer.h" -// //class AliPHOSCalibrationDB ; -// class AliPHOSConTableDB ; +class AliPHOSClusterizer ; +class AliPHOSTrackSegmentMaker ; +class AliPHOSPID ; class AliPHOSBeamTestEvent ; - -#include "AliPHOSLoader.h" +class AliESD ; +class AliRawReader ; class AliPHOSGetter : public TObject { - public: - AliPHOSGetter(){ // ctor: this is a singleton, the ctor should never be called but cint needs it as public - Fatal("ctor", "AliPHOSGetter is a singleton default ctor not callable") ; - } - AliPHOSGetter(const AliPHOSGetter & obj) : TObject(obj) { - // cpy ctor requested by Coding Convention - Fatal("cpy ctor", "not implemented") ; - } - +public: + // ctor: this is a singleton, the ctor should never be called but cint needs it as public + AliPHOSGetter() ; + +public: + AliPHOSGetter(const AliPHOSGetter & obj) ; AliPHOSGetter & operator = (const AliPHOSGetter & ) { // assignement operator requested by coding convention, but not needed Fatal("operator =", "not implemented") ; @@ -64,168 +64,196 @@ class AliPHOSGetter : public TObject { //=========== Instantiators ================ static AliPHOSGetter * Instance(const char* headerFile, - const char* version = AliConfig::fgkDefaultEventFolderName, + const char* version = AliConfig::GetDefaultEventFolderName(), Option_t * openingOption = "READ" ) ; static AliPHOSGetter * Instance() ; - + + void Print(const Option_t *)const{} static void Print() ; -// //=========== General information about run ============== - Bool_t IsLoaded(const TString tree) const { return fLoadingStatus.Contains(tree) ; } - void SetLoaded(const TString tree) { fLoadingStatus += tree ; } - - Int_t MaxEvent() const ; - Int_t EventNumber() const ; - Bool_t VersionExists(TString & opt) const ; - UShort_t EventPattern(void) const ; - Float_t BeamEnergy(void) const ; + //=========== General information about run ============== + virtual Bool_t IsLoaded(TString tree) const { return fLoadingStatus.Contains(tree) ; } + virtual void SetLoaded(TString tree) { fLoadingStatus += tree ; } -// //========== PHOSGeometry and PHOS ============= - AliPHOS * PHOS() const ; - AliPHOSGeometry * PHOSGeometry() const ; + virtual Int_t MaxEvent() const ; + virtual Int_t EventNumber() const ; + virtual Bool_t VersionExists(TString & opt) const ; + virtual UShort_t EventPattern(void) const ; + virtual Float_t BeamEnergy(void) const ; -// //========== Methods to read something from file ========== - void Event(const Int_t event, const char * opt = "HSDRP") ; - void Track(const Int_t itrack) ; + //========== PHOSGeometry and PHOS ============= + virtual AliPHOS * PHOS() const ; + virtual AliPHOSGeometry * PHOSGeometry() const ; -// //-----------------now getter's data-------------------------------------- -// // AliPHOSCalibrationDB * CalibrationDB(){return fcdb; } -// // void ReadCalibrationDB(const char * name, const char * filename) ; + //========== Methods to read something from file ========== + virtual void Event(Int_t event, const char * opt = "HSDRTP") ; + void Event(AliRawReader *rawReader, const char * opt = "W",Bool_t isOldRCUFormat = kFALSE) ; + virtual void Track(Int_t itrack) ; + + + //-----------------now getter's data-------------------------------------- + AliPHOSCalibrationDB * CalibrationDB(){return fcdb; } + void ReadCalibrationDB(const char * /*name*/, const char * /*filename*/){ ;} + void SetCalibrationDB(AliPHOSCalibrationDB * cdb) {fcdb = cdb ;} + + void SetCalibData(AliPHOSCalibData* calibda) { fgCalibData = calibda; } + AliPHOSCalibData * CalibData(); //=========== Primaries ============ -// TTree * TreeK(TString filename="") ; - TClonesArray * Primaries(void) ; - TParticle * Primary(Int_t index) const ; - Int_t NPrimaries()const { return fNPrimaries; } - TParticle * Secondary(const TParticle * p, const Int_t index=1) const ; - -// //=========== Hits ================= -// TTree * TreeH(TString filename="") ; - TClonesArray * Hits(void) ; - AliPHOSHit * Hit(const Int_t index) { return dynamic_cast(Hits()->At(index) );} - TTree * TreeH() const ; + virtual TClonesArray * Primaries(void) ; + virtual TParticle * Primary(Int_t index) const ; + virtual Int_t NPrimaries()const { return fNPrimaries; } + virtual TParticle * Secondary(const TParticle * p, Int_t index=1) const ; + + //=========== Hits ================= + virtual TClonesArray * Hits(void) const ; + virtual AliPHOSHit * Hit(Int_t index) const { return dynamic_cast(Hits()->At(index) );} + virtual TTree * TreeH() const ; //=========== SDigits ============== - TClonesArray * SDigits() ; - AliPHOSDigit * SDigit(const Int_t index) { return static_cast(SDigits()->At(index)) ;} - TTree * TreeS() const ; - AliPHOSSDigitizer * SDigitizer() ; - - TString GetSDigitsFileName() { return PhosLoader()->GetSDigitsFileName() ; } - Int_t LoadSDigits(Option_t* opt="") { return PhosLoader()->LoadSDigits(opt) ; } - Int_t LoadSDigitizer(Option_t* opt=""){ return PhosLoader()->LoadSDigitizer(opt) ; } - Int_t WriteSDigits(Option_t* opt="") { return PhosLoader()->WriteSDigits(opt) ; } - Int_t WriteSDigitizer(Option_t* opt=""){ + virtual TClonesArray * SDigits() const ; + virtual AliPHOSDigit * SDigit(Int_t index) const { return static_cast(SDigits()->At(index)) ;} + virtual TTree * TreeS() const ; + virtual AliPHOSSDigitizer * SDigitizer() ; + + virtual TString GetSDigitsFileName() const { return PhosLoader()->GetSDigitsFileName() ; } + virtual Int_t LoadSDigits(Option_t* opt="") const { return PhosLoader()->LoadSDigits(opt) ; } + virtual Int_t LoadSDigitizer(Option_t* opt="") const { return PhosLoader()->LoadSDigitizer(opt) ; } + virtual Int_t WriteSDigits(Option_t* opt="") const { return PhosLoader()->WriteSDigits(opt) ; } + virtual Int_t WriteSDigitizer(Option_t* opt="") const { return PhosLoader()->WriteSDigitizer(opt) ; } //========== Digits ================ - TClonesArray * Digits() ; - AliPHOSDigit * Digit(const Int_t index) { return static_cast(Digits()->At(index)) ;} - TTree * TreeD() const ; - AliPHOSDigitizer * Digitizer() ; - TString GetDigitsFileName() { return PhosLoader()->GetDigitsFileName() ; } - Int_t LoadDigits(Option_t* opt="") { return PhosLoader()->LoadDigits(opt) ; } - Int_t LoadDigitizer(Option_t* opt=""){ + virtual TClonesArray * Digits() const ; + virtual AliPHOSDigit * Digit(Int_t index) const { return static_cast(Digits()->At(index)) ;} + virtual TTree * TreeD() const ; + virtual AliPHOSDigitizer * Digitizer() ; + virtual TString GetDigitsFileName() const { return PhosLoader()->GetDigitsFileName() ; } + virtual Int_t LoadDigits(Option_t* opt="") const { return PhosLoader()->LoadDigits(opt) ; } + virtual Int_t LoadDigitizer(Option_t* opt="") const { return PhosLoader()->LoadDigitizer(opt) ; } - Int_t WriteDigits(Option_t* opt="") { return PhosLoader()->WriteDigits(opt) ; } - Int_t WriteDigitizer(Option_t* opt=""){ + virtual Int_t WriteDigits(Option_t* opt="") const { return PhosLoader()->WriteDigits(opt) ; } + virtual Int_t WriteDigitizer(Option_t* opt="") const { return PhosLoader()->WriteDigitizer(opt) ; } + + //Methods to distinguish raw and simulated digits + virtual Bool_t IsRawDigits(void) const {return fRawDigits;} + virtual void SetRawDigits(Bool_t isRaw = kTRUE){fRawDigits = isRaw;} //========== RecPoints ============= - TObjArray * EmcRecPoints() ; - AliPHOSEmcRecPoint * EmcRecPoint(const Int_t index) { return static_cast(EmcRecPoints()->At(index)) ;} - TObjArray * CpvRecPoints() ; - AliPHOSCpvRecPoint * CpvRecPoint(const Int_t index) { return static_cast(CpvRecPoints()->At(index)) ;} - TTree * TreeR() const ; - AliPHOSClusterizer * Clusterizer() ; - TString GetRecPointsFileName() { return PhosLoader()->GetRecPointsFileName() ; } - Int_t LoadRecPoints(Option_t* opt="") { return PhosLoader()->LoadRecPoints(opt) ; } - Int_t LoadClusterizer(Option_t* opt=""){ + virtual TObjArray * EmcRecPoints() const; + virtual AliPHOSEmcRecPoint * EmcRecPoint(Int_t index) const { return static_cast(EmcRecPoints()->At(index)) ;} + virtual TObjArray * CpvRecPoints() const ; + virtual AliPHOSCpvRecPoint * CpvRecPoint(Int_t index) const { return static_cast(CpvRecPoints()->At(index)) ;} + virtual TTree * TreeR() const ; + virtual AliPHOSClusterizer * Clusterizer() ; + virtual TString GetRecPointsFileName() const { return PhosLoader()->GetRecPointsFileName() ; } + virtual Int_t LoadRecPoints(Option_t* opt="") const { return PhosLoader()->LoadRecPoints(opt) ; } + virtual Int_t LoadClusterizer(Option_t* opt="") const { return PhosLoader()->LoadClusterizer(opt) ; } - Int_t WriteRecPoints(Option_t* opt="") { return PhosLoader()->WriteRecPoints(opt) ; } - Int_t WriteClusterizer(Option_t* opt=""){ + virtual Int_t WriteRecPoints(Option_t* opt="") const { return PhosLoader()->WriteRecPoints(opt) ; } + virtual Int_t WriteClusterizer(Option_t* opt="") const { return PhosLoader()->WriteClusterizer(opt) ; } - + //========== TrackSegments TClonesArray * TrackSegments(const char * name = 0) { - TClonesArray * TrackSegments() ; - AliPHOSTrackSegment * TrackSegments(const Int_t index) { return static_cast(TrackSegments()->At(index)) ;} - TTree * TreeT() const ; - AliPHOSTrackSegmentMaker * TrackSegmentMaker() ; - TString GetTracksFileName() { return PhosLoader()->GetTracksFileName() ; } - Int_t LoadTracks(Option_t* opt="") { return PhosLoader()->LoadTracks(opt) ; } - Int_t LoadTrackSegementMaker(Option_t* opt=""){ + virtual TClonesArray * TrackSegments() const; + virtual AliPHOSTrackSegment * TrackSegment(Int_t index) const { return static_cast(TrackSegments()->At(index)) ;} + virtual TTree * TreeT() const ; + virtual AliPHOSTrackSegmentMaker * TrackSegmentMaker() ; + virtual TString GetTracksFileName() const { return PhosLoader()->GetTracksFileName() ; } + virtual Int_t LoadTracks(Option_t* opt="") const { return PhosLoader()->LoadTracks(opt) ; } + virtual Int_t LoadTrackSegementMaker(Option_t* opt="") const { return PhosLoader()->LoadTrackSegmentMaker(opt) ; } - Int_t WriteTracks(Option_t* opt="") { return PhosLoader()->WriteTracks(opt) ; } - Int_t WriteTrackSegmentMaker(Option_t* opt=""){ + virtual Int_t WriteTracks(Option_t* opt="") const { return PhosLoader()->WriteTracks(opt) ; } + virtual Int_t WriteTrackSegmentMaker(Option_t* opt="") const { return PhosLoader()->WriteTracker(opt) ; } + //========== RecParticles =========== - - TClonesArray * RecParticles() ; - AliPHOSRecParticle * RecPaticles(const Int_t index) { return static_cast(RecParticles()->At(index)) ;} - TTree * TreeP() const ; - AliPHOSPID * PID() ; - TString GetRecParticlesFileName() { return PhosLoader()->GetRecParticlesFileName() ; } - Int_t LoadRecParticles(Option_t* opt="") { return PhosLoader()->LoadRecParticles(opt) ; } - Int_t LoadPID(Option_t* opt=""){ + virtual TClonesArray * RecParticles() const; + virtual AliPHOSRecParticle * RecParticle(Int_t index) const { return static_cast(RecParticles()->At(index)) ;} + virtual TTree * TreeP() const ; + virtual AliPHOSPID * PID() ; + virtual TString GetRecParticlesFileName() const { return PhosLoader()->GetRecParticlesFileName() ; } + virtual Int_t LoadRecParticles(Option_t* opt="") const { return PhosLoader()->LoadRecParticles(opt) ; } + virtual Int_t LoadPID(Option_t* opt="") const { return PhosLoader()->LoadPID(opt) ; } - Int_t WriteRecParticles(Option_t* opt="") { return PhosLoader()->WriteRecParticles(opt) ; } - Int_t WritePID(Option_t* opt=""){ + virtual Int_t WriteRecParticles(Option_t* opt="") const { return PhosLoader()->WriteRecParticles(opt) ; } + virtual Int_t WritePID(Option_t* opt="") const { return PhosLoader()->WritePID(opt) ; } + //========== Raw =========== + virtual Int_t ReadRaw(AliRawReader *rawReader,Bool_t isOldRCUFormat) ; void SetDebug(Int_t level) {fgDebug = level;} // Set debug level - void PostClusterizer(AliPHOSClusterizer * clu) + virtual void PostClusterizer(AliPHOSClusterizer * clu) const{PhosLoader()->PostClusterizer(clu) ; } - void PostPID(AliPHOSPID * pid) + virtual void PostPID(AliPHOSPID * pid) const{PhosLoader()->PostPID(pid) ; } - void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr) + virtual void PostTrackSegmentMaker(AliPHOSTrackSegmentMaker * tr) const{PhosLoader()->PostTrackSegmentMaker(tr) ; } - void PostSDigitizer (AliPHOSSDigitizer * sdigitizer) + virtual void PostSDigitizer (AliPHOSSDigitizer * sdigitizer) const {PhosLoader()->PostSDigitizer(sdigitizer);} - void PostDigitizer (AliPHOSDigitizer * digitizer) - const {PhosLoader()->PostDigitizer(dynamic_cast(digitizer));} - - TString Version() const { return PhosLoader()->GetTitle() ; } - AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; } + virtual void PostDigitizer (AliPHOSDigitizer * digitizer) + const {PhosLoader()->PostDigitizer(digitizer);} -private: + virtual TString Version() const { return PhosLoader()->GetTitle() ; } + virtual AliPHOSLoader * PhosLoader() const { return fgPhosLoader ; } + virtual void Reset() ; + virtual AliESD * ESD() const { return fESD ; } + +protected : + AliPHOSGetter(Int_t /*i*/) ; + +protected: + static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton + +private: AliPHOSGetter(const char* headerFile, - const char* version = AliConfig::fgkDefaultEventFolderName, + const char* version = AliConfig::GetDefaultEventFolderName(), Option_t * openingOption = "READ") ; - - Int_t ReadTreeD(void) ; - Int_t ReadTreeH(void) ; - Int_t ReadTreeR(void) ; - Int_t ReadTreeT(void) ; - Int_t ReadTreeS(void) ; - Int_t ReadTreeP(void) ; - - +private: + + Int_t ReadTreeD(void) const ; + Int_t ReadTreeH(void) const ; + Int_t ReadTreeR(void) const ; + Int_t ReadTreeT(void) const ; + Int_t ReadTreeS(void) const ; + Int_t ReadTreeP(void) const ; + + Int_t ReadTreeE(Int_t event) ; + Bool_t OpenESDFile() ; void ReadPrimaries(void) ; -private: + void FitRaw(Bool_t lowGainFlag, TGraph * gLowGain, TGraph * gHighGain, TF1* signalF, Double_t & energy, Double_t & time) const; -// static TFile * fgFile; //! + Int_t CalibrateRaw (Double_t energy, Int_t *relId); +private: + AliPHOSBeamTestEvent * fBTE ; //! Header if BeamTest Event - static Int_t fgDebug ; //! Debug level - + TString fLoadingStatus ; //! tells which trees are loaded Int_t fNPrimaries ; //! # of primaries TClonesArray * fPrimaries ; //! list of lists of primaries - -// AliPHOSCalibrationDB * fcdb ; //! - - static AliPHOSLoader * fgPhosLoader ; - static AliPHOSGetter * fgObjGetter; // pointer to the unique instance of the singleton + TFile * fESDFile ; //! ESD file + TString fESDFileName ; //! ESD File Name + AliESD * fESD ; //! ESD object + TTree * fESDTree ; //! ESD Tree - enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes}; + Bool_t fRawDigits ; //! true is raw data + AliPHOSCalibrationDB * fcdb ; //! Calibration DB for beam test run 2004 + static AliPHOSCalibData * fgCalibData; //! instance of AliPHOSCalibData - ClassDef(AliPHOSGetter,1) // Algorithm class that provides methods to retrieve objects from a list knowing the index + static AliPHOSLoader * fgPhosLoader ; // the loader for the NewIO + + enum EDataTypes{kHits,kSDigits,kDigits,kRecPoints,kTracks,kNDataTypes}; -}; + + ClassDef(AliPHOSGetter,2) // Algorithm class that provides methods to retrieve objects from a list knowing the index + + }; #endif // AliPHOSGETTER_H