//////////////////////////////////// // KRATTA Run Info // for the Asy-Eos experiment // TRunInfo DECLARATION // Apr 2014 // revison 04/2014 // E.d.F ver 1.0 // sebastian.kupny@uj.edu.pl // Changes: // // if you want make them as a singleton check: // http://www.yolinux.com/TUTORIALS/C++Singleton.html //////////////////////////////////// #ifndef ASYEOSROOT_TRUN_INFO_H #define ASYEOSROOT_TRUN_INFO_H //#include #include #include #include //#include #include #include #include "TSystem.h" #include "TRunInfoTypes.h" #include "TRunInfoCont.h" ////////////////////////////////////////////////////////////////////////// // // // TRunInfo // // // // The TRunInfoCont class is a assistant which allows manage with // // the features of each run (metadata) // // filenames. // // // ////////////////////////////////////////////////////////////////////////// class TRunInfo { private: Int_t fDebugLevel; TString fLastLoadedFile; /// Last loaded file with the information (run metadata) std::vector fListOfRuns; TRunInfoCont fLastUsedRunInfoCont; /// Last loaded file (just to avoid searching each time over the vector) Bool_t UpdateLastUsedRunInfoCont ( Int_t run); TRunInfoCont ParseTokensV1 ( std::vector tokensFromOneLine ); /// Function used used for extracting the data from file std::string TruncateComment( std::string iStr ); std::vector SplitString( std::string lineToSplit); // std::string TrimString( std::string str ); // Bool_t IsComment( std::string str ); public: TRunInfo(); void Config( void ); void Config( TString pathToFileWithLists ); void ClearRunlist( void); Int_t LoadFilesWithListV1( TString fileWithListOfRunsFeatures ); void SetDebugLevel( const Int_t debugLevel = 1){ fDebugLevel = debugLevel; }; Int_t GetDebugLevel( void ) const { return fDebugLevel; }; /// Getters: Int_t GetNloadedRuns( void ){ return fListOfRuns.size(); }; TRunInfoCont GetRunInfoCont ( Int_t run ); Bool_t IsRunInfoCont ( Int_t run ); /// Returns true if the meta data of the run "run" are available Int_t GetRunNumber ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetRunNumber(); }; Bool_t IsShadowBar ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsShadowBar(); }; Bool_t IsCalib ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsCalib(); }; Bool_t IsAutomClosed ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsAutomClosed(); }; Bool_t IsBadFile ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsBadFile(); }; EProjectile GetProjectile ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetProjectile(); }; ETarget GetTarget ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetTarget(); }; Bool_t IsSetting ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsSetting(); }; Bool_t IsRegStat ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsRegStat(); }; Bool_t IsGoodPhys ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsGoodPhys(); }; Long_t GetNBeamPart ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetNBeamPart(); }; Long_t GetNBeamBeamAcc ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetNBeamBeamAcc(); }; Long_t GetNCosmicLandAcc ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetNCosmicLandAcc(); }; Long_t GetNTofGbAcc ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetNTofGbAcc(); }; Long_t GetNTofGbLandAcc ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetNTofGbLandAcc(); }; Bool_t IsGoodNBeamPart ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsGoodNBeamPart(); }; Bool_t IsGoodNBeamBeamAcc ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsGoodNBeamBeamAcc(); }; Bool_t IsGoodNCosmicLandAcc( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsGoodNCosmicLandAcc();}; Bool_t IsGoodNTofGbAcc ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsGoodNTofGbAcc(); }; Bool_t IsGoodNTofGbLandAcc ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.IsGoodNTofGbLandAcc(); }; TString GetNote ( Int_t run ) { UpdateLastUsedRunInfoCont( run ); return fLastUsedRunInfoCont.GetNote(); }; ClassDef(TRunInfo,1); }; #endif /// ASYEOSROOT_TRUN_INFO_H