X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EMCAL%2FAliEMCALLoader.h;h=9cb52b0de6baf0ac21062809886994093accdb3e;hb=951a6a05a7c1ca1341aca9074dfc920d1313c97f;hp=0600f65528fddb5fa70324a6b33e27a1a83fc6ff;hpb=88cb7938ca21d4a80991d4e7aa564008c29340f7;p=u%2Fmrichter%2FAliRoot.git diff --git a/EMCAL/AliEMCALLoader.h b/EMCAL/AliEMCALLoader.h index 0600f65528f..9cb52b0de6b 100644 --- a/EMCAL/AliEMCALLoader.h +++ b/EMCAL/AliEMCALLoader.h @@ -24,342 +24,108 @@ class TString ; class TParticle ; class TTask ; -// --- Standard library --- -#include -#include - // --- AliRoot header files --- - -#include "AliRun.h" #include "AliLoader.h" -#include "AliRunLoader.h" -#include "AliEMCAL.h" -#include "AliEMCALHit.h" -#include "AliEMCALDigit.h" -#include "AliEMCALTowerRecPoint.h" -#include "AliEMCALTrackSegment.h" -#include "AliEMCALRecParticle.h" -class AliEMCALGeometry ; -#include "AliEMCALDigitizer.h" -#include "AliEMCALSDigitizer.h" -#include "AliEMCALClusterizer.h" -#include "AliEMCALTrackSegmentMaker.h" -#include "AliEMCALPID.h" -class AliEMCALCalibrationDB ; +#include "AliEMCALCalibData.h" - -// +class AliLoader ; +class AliEMCAL ; +class AliEMCALHit ; +class AliEMCALDigit ; +class AliEMCALSDigit ; +class AliEMCALRecPoint ; class AliEMCALLoader : public AliLoader { public: AliEMCALLoader(); - AliEMCALLoader(const AliEMCALLoader & obj){} + AliEMCALLoader(const AliEMCALLoader & obj); AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername); + AliEMCALLoader(const Char_t *name,TFolder *topfolder); virtual ~AliEMCALLoader() ; // assignement operator requested by coding convention, but not needed - AliEMCALLoader & operator = (const AliEMCALLoader & ) {return *this;} - - Int_t GetEvent();//extends the method on EMCAL RecPart posting - Int_t SetEvent();//extends the method on EMCAL RecPart posting - - Bool_t BranchExists(const TString& recName); - Int_t LoadHits(Option_t* opt=""); //reads from disk and sends them to folder; array as well as tree - Int_t LoadSDigits(Option_t* opt=""); - Int_t LoadDigits(Option_t* opt=""); //reads Digits from disk and sends them to folder; array as well as tree - Int_t LoadRecPoints(Option_t* opt=""); //reads RecPoints from disk and sends them to folder; array as well as tree - Int_t LoadTracks(Option_t* opt=""); //reads Tracks from disk and sends them to folder; array as well as tree - Int_t LoadRecParticles(Option_t* opt=""); - - void UnloadRecParticles(); - void UnloadTracks(); - - Int_t PostHits(); //Posts the - Int_t PostSDigits(); - Int_t PostDigits(); - Int_t PostRecPoints(); - Int_t PostTracks(); - Int_t PostRecParticles(); - - void CleanFolders();//cleans all the stuff loaded by this detector + calls AliLoader::Clean - - void CleanHits(); - void CleanSDigits(); - void CleanDigits(); - void CleanRecPoints(); - void CleanTracks(); - void CleanRecParticles(); - -//up to now it is only here -> no definition about global/incremental tracking/PID - -// Int_t WriteRecParticles(Option_t* opt="");//writes the reconstructed particles -// Int_t WritePID(Option_t* opt="");//writes the task for PID to file -// Bool_t PostPID (AliEMCALPID * pid) const {return kTRUE;} -// Bool_t PostQA (void) const ; //it was empty anyway - -/*******************************************************************/ -/*******************************************************************/ -/*******************************************************************/ - - TObject** HitsRef(){return GetDetectorDataRef(Hits());} - TObject** SDigitsRef(){return GetDetectorDataRef(SDigits());} - TObject** DigitsRef(){return GetDetectorDataRef(Digits());} - TObject** PRERecPointsRef(){return GetDetectorDataRef(PRERecPoints());} - TObject** ECARecPointsRef(){return GetDetectorDataRef(ECARecPoints());} - TObject** HCARecPointsRef(){return GetDetectorDataRef(HCARecPoints());} - TObject** TracksRef(){return GetDetectorDataRef(TrackSegments());} - TObject** RecParticlesRef(){return GetDetectorDataRef(RecParticles());} - TObject** AlarmsRef(){return GetDetectorDataRef(Alarms());} - void Track(Int_t itrack) ; - - static AliEMCALGeometry* GetEMCALGeometry(); - static AliEMCALLoader* GetEMCALLoader(const char* eventfoldername); - - //Method to be used when digitizing under AliRunDigitizer, who opens all files etc. - Int_t EventNumber() { return (Int_t) GetRunLoader()->GetEventNumber();} - Int_t MaxEvent() { return (Int_t) GetRunLoader()->TreeE()->GetEntries();} - - const AliEMCAL * EMCAL(); - const AliEMCALGeometry *EMCALGeometry() ; - // Alarms - // TFolder * Alarms() const { return (TFolder*)(ReturnO("Alarms", 0)); } - TObjArray * Alarms(); - - /*********************************************/ - /************ TClonesArrays ***********/ - /*********************************************/ - /**** H i t s ****/ - TClonesArray* Hits(void); - const AliEMCALHit* Hit(Int_t index); - void MakeHitsArray(); - /**** S D i g i t s ****/ - TClonesArray* SDigits(); - const AliEMCALDigit* SDigit(Int_t index); - void MakeSDigitsArray(); - /**** D i g i t s ****/ - TClonesArray* Digits(); - const AliEMCALDigit * Digit(Int_t index); - void MakeDigitsArray(); - /**** R e c P o i n t s ****/ - TObjArray * PRERecPoints(); - TObjArray * ECARecPoints(); - TObjArray * HCARecPoints(); - const AliEMCALRecPoint * PRERecPoint(Int_t index) ; - const AliEMCALTowerRecPoint * ECARecPoint(Int_t index) ; - const AliEMCALTowerRecPoint * HCARecPoint(Int_t index) ; - void MakeRecPointsArray(); - /**** T r a c k S e g m e n t s ****/ - TClonesArray * TrackSegments(); - const AliEMCALTrackSegment * TrackSegment(Int_t index); - void MakeTrackSegmentsArray(); - /**** R e c P a r t ic l e s ****/ - TClonesArray * RecParticles() ; - const AliEMCALRecParticle * RecParticle(Int_t index); - void MakeRecParticlesArray(); - - /*********************************************/ - /************ T A S K S **************/ - /*********************************************/ - // - // AliEMCALSDigitizer* EMCALSDigitizer(TString name = AliConfig::fgkDefaultEventFolderName); - //AliEMCALDigitizer* EMCALDigitizer() { return dynamic_cast(Digitizer()) ;} - - AliEMCALClusterizer* Clusterizer () {return dynamic_cast(Reconstructioner()) ;} - Int_t PostClusterizer(TTask* clust){return PostReconstructioner(clust);} - Int_t LoadClusterizer(Option_t * opt="") {return LoadReconstructioner(opt);} - Int_t WriteClusterizer(Option_t * opt="") {return WriteReconstructioner(opt);} - - AliEMCALPID * PID (){return dynamic_cast(PIDTask()) ;} - Int_t PostPID(TTask* pid){return PostPIDTask(pid);} - Int_t LoadPID(Option_t * opt="") {return LoadPIDTask(opt);} - Int_t WritePID(Option_t * opt="") {return WritePIDTask(opt);} + const AliEMCALLoader & operator = (const AliEMCALLoader & ) {return *this;} + + virtual Int_t GetEvent(); // Overload to fill TClonesArray + + virtual void CleanHits() const + { if (fHits) fHits->Clear(); AliLoader::CleanHits(); } + virtual void CleanSDigits() const + { if (fSDigits) fSDigits->Clear(); AliLoader::CleanSDigits(); } + virtual void CleanDigits() const + { if (fDigits) fDigits->Clear(); AliLoader::CleanDigits(); } + virtual void CleanRecPoints() const + { if (fRecPoints) fRecPoints->Clear(); AliLoader::CleanRecPoints(); } + + // This does not work due to const + /* + virtual void MakeHitsContainer() const { AliLoader::MakeHitsContainer(); TreeH()->Branch(fDetectorName,"TClonesArray",&fHits); } + virtual void MakeSDigitsContainer() const { AliLoader::MakeSDigitsContainer(); TreeS()->SetBranchAddress(fDetectorName,&fSDigits); } + virtual void MakeDigitsContainer() const { AliLoader::MakeDigitsContainer(); TreeD()->SetBranchAddress(fDetectorName,&fDigits); } + virtual void MakeRecPointsContainer() const { AliLoader::MakeRecPointsContainer(); TreeR()->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints); } + */ + + // ************ TClonesArrays Access functions + + TClonesArray* Hits(void) { return fHits;} + + const AliEMCALHit* Hit(Int_t index) { + if (fHits) + return (const AliEMCALHit*) fHits->At(index); + return 0x0; + } + + TClonesArray* SDigits() { return fSDigits;} + const AliEMCALDigit* SDigit(Int_t index) { + if (fSDigits) + return (const AliEMCALDigit*) fSDigits->At(index); + return 0x0; + } + + TClonesArray* Digits() { return fDigits;} + const AliEMCALDigit * Digit(Int_t index) { + if (fDigits) + return (const AliEMCALDigit*) fDigits->At(index); + return 0x0; + } + + TObjArray * RecPoints() { return fRecPoints;} + const AliEMCALRecPoint * RecPoint(Int_t index) { + if (fRecPoints) + return (const AliEMCALRecPoint*) fRecPoints->At(index); + return 0x0; + } + void SetDebug(Int_t level) {fDebug = level;} // Set debug level - AliEMCALTrackSegmentMaker * TrackSegmentMaker () { return dynamic_cast(Tracker()) ;} - Int_t PostTrackSegmentMaker(TTask* segmaker){return PostTracker(segmaker);} - Int_t LoadTrackSegmentMaker(Option_t * opt="") {return LoadTracker(opt);} - Int_t WriteTrackSegmentMaker(Option_t * opt="") {return WriteTracker(opt);} + //Calibration + Int_t CalibrateRaw (Double_t energy, Int_t module, Int_t column, Int_t row);//take real calibration coefficients - void SetDebug(Int_t level) {fDebug = level;} // Set debug level - void SetBranchTitle(const TString& btitle); - - AliEMCALCalibrationDB * CalibrationDB(){return fcdb; } - //void ReadCalibrationDB(const char * name, const char * filename); - -protected: - TString fBranchTitle; //Title of the branch - Bool_t fRecParticlesLoaded; //Flag signing if Reconstructed Particles are loaded - Bool_t fTracksLoaded; //Flag signing if Tracks are loaded - TString fRecParticlesFileOption; //Loading Option for Reconstructed Particles - AliEMCALCalibrationDB * fcdb ; //! + void SetCalibData(AliEMCALCalibData* calibda) { fgCalibData = calibda; } + AliEMCALCalibData * CalibData(); // to get the calibration CDB object private: - - Int_t ReadHits(); - Int_t ReadDigits(); - Int_t ReadSDigits(); - Int_t ReadRecPoints(); - Int_t ReadTracks(); - Int_t ReadRecParticles(); - - void ReadTreeQA() ; - Int_t fDebug ; // Debug level - public: + static const TString fgkECARecPointsBranchName; //! Name of branch with ECA Reconstructed Points - static const TString fgkHitsName;//Name for TClonesArray with hits from one event - static const TString fgkSDigitsName;//Name for TClonesArray - static const TString fgkDigitsName;//Name for TClonesArray - static const TString fgkPRERecPointsName;//Name for TClonesArray - static const TString fgkECARecPointsName;//Name for TClonesArray - static const TString fgkHCARecPointsName;//Name for TClonesArray - static const TString fgkTracksName;//Name for TClonesArray - static const TString fgkRecParticlesName;//Name for TClonesArray + Int_t fDebug ; // Debug level - static const TString fgkPRERecPointsBranchName;//Name for branch - static const TString fgkECARecPointsBranchName;//Name for branch - static const TString fgkHCARecPointsBranchName;//Name for branch - static const TString fgkTrackSegmentsBranchName;//Name for branch - static const TString fgkRecParticlesBranchName;//Name for branch + // All data are stored in TTrees on file. + // These TCLonesArrays are temporary storage for reading or writing + // (connected to TTrees with SetBranchAddress) + TClonesArray *fHits; //! TClonesArray of hits (for tree reading) + TClonesArray *fDigits; //! TClonesArray of digits (for tree reading) + TClonesArray *fSDigits; //! TClonesArray of sdigits (for tree reading) + TObjArray *fRecPoints; //! TClonesArray of recpoints (for tree reading) - ClassDef(AliEMCALLoader,2) // Algorithm class that provides methods to retrieve objects from a list knowing the index + static AliEMCALCalibData * fgCalibData; // calibration data + ClassDef(AliEMCALLoader,2) // Algorithm class that provides methods to retrieve objects from a list knowing the index + }; -/******************************************************************************/ -/**************** I N L I N E S ****************************************/ -/******************************************************************************/ - -inline TClonesArray* AliEMCALLoader::Hits() -{ - return (TClonesArray*)GetDetectorData(fgkHitsName); -} -/******************************************************************************/ - -inline const AliEMCALHit* AliEMCALLoader::Hit(Int_t index) -{ - const TClonesArray* tcarr = Hits(); - if (tcarr) - return (const AliEMCALHit*) tcarr->At(index); - return 0x0; -} -/******************************************************************************/ - -inline TClonesArray* AliEMCALLoader::SDigits() -{ - return dynamic_cast(GetDetectorData(fgkSDigitsName)); -} -/******************************************************************************/ - -inline const AliEMCALDigit* AliEMCALLoader::SDigit(Int_t index) -{ - const TClonesArray* tcarr = SDigits(); - if (tcarr) - return (const AliEMCALDigit*) tcarr->At(index); - return 0x0; -} -/******************************************************************************/ - -inline TClonesArray* AliEMCALLoader::Digits() -{ - return dynamic_cast(GetDetectorData(fgkDigitsName)); -} -/******************************************************************************/ - -inline const AliEMCALDigit* AliEMCALLoader::Digit(Int_t index) -{ - const TClonesArray* tcarr = Digits(); - if (tcarr) - return (const AliEMCALDigit*) tcarr->At(index); - return 0x0; -} - -/******************************************************************************/ - -inline TObjArray * AliEMCALLoader::PRERecPoints() -{ - return dynamic_cast(GetDetectorData(fgkPRERecPointsName)); -} -/******************************************************************************/ - -inline const AliEMCALRecPoint * AliEMCALLoader::PRERecPoint(Int_t index) -{ - TObjArray* tcarr = PRERecPoints(); - if (tcarr) - return dynamic_cast(tcarr->At(index)); - return 0x0; -} - -/******************************************************************************/ - -inline TObjArray * AliEMCALLoader::ECARecPoints() -{ - return dynamic_cast(GetDetectorData(fgkECARecPointsName)); -} - -/******************************************************************************/ - -inline const AliEMCALTowerRecPoint * AliEMCALLoader::ECARecPoint(Int_t index) -{ - TObjArray* tcarr = ECARecPoints(); - if (tcarr) - return dynamic_cast(tcarr->At(index)); - return 0x0; -} - -/******************************************************************************/ - -inline TObjArray * AliEMCALLoader::HCARecPoints() -{ - return dynamic_cast(GetDetectorData(fgkHCARecPointsName)); -} - -/******************************************************************************/ - -inline const AliEMCALTowerRecPoint * AliEMCALLoader::HCARecPoint(Int_t index) -{ - TObjArray* tcarr = HCARecPoints(); - if (tcarr) - return dynamic_cast(tcarr->At(index)); - return 0x0; -} - -/******************************************************************************/ - -inline TClonesArray * AliEMCALLoader::TrackSegments() -{ - return dynamic_cast(GetDetectorData(fgkTracksName)); -} -/******************************************************************************/ - -inline const AliEMCALTrackSegment * AliEMCALLoader::TrackSegment(Int_t index) -{ - const TClonesArray* tcarr = TrackSegments(); - if (tcarr) - return (const AliEMCALTrackSegment*) tcarr->At(index); - return 0x0; -} -/******************************************************************************/ - -inline TClonesArray * AliEMCALLoader::RecParticles() -{ - return dynamic_cast(GetDetectorData(fgkRecParticlesName)); -} -/******************************************************************************/ - -inline const AliEMCALRecParticle* AliEMCALLoader::RecParticle(Int_t index) -{ - TClonesArray* tcarr = RecParticles(); - if (tcarr) - return (const AliEMCALRecParticle*) tcarr->At(index); - return 0x0; -} -/******************************************************************************/ -inline TObjArray * AliEMCALLoader::Alarms() -{ return (TObjArray*)(GetQAFolder()->FindObject(fDetectorName));} - #endif // AliEMCALLOADER_H