#ifndef __HBEAMTIME_H__ #define __HBEAMTIME_H__ #include "htime.h" #include "TString.h" #include "TObject.h" #include #include #include #include #include using namespace std; namespace HADES { // ------------------------------------------------------------------------- // flags for beam times enum eBeamTime { kUnknownBeam = 0, kApr12 = 1, kJul14 = 2, kAug14 = 3, kMar19 = 4, kFeb22 = 5, kFeb24 = 6, kApr25 = 7 }; } class HBeamPar : public TObject { public: HBeamPar() { reset(); } Int_t beamID; // kApr12 .... Double_t beamEnergy; // [MeV/u]: KApr12 : 1230 Double_t fieldFactor; // KApr12 : 0.7215 TString collisionSystem;// KApr12 : Au+Au Int_t firstRunID; // first runID in this beam periode Int_t lastRunID; // last runID in this beam periode TString firstFile; // name of first file default "Not_set" TString lastFile; // name of last file default "Not_set" void setPar(Int_t id,Double_t energ,Double_t field,TString system,Int_t first,Int_t last,TString f1="Not_set",TString f2="Not_set"){ beamID = id; beamEnergy = energ; fieldFactor = field; collisionSystem = system; firstRunID = first; lastRunID = last; firstFile = f1; lastFile = f2; } void reset() { setPar(HADES::kUnknownBeam,0.,0.,"Not_set",-1,-1); } void print() { if(firstRunID < 100000){ // simulation printf("HBeamPar :: BeamID : %5d, BeamEnergy : %5.0f [Mev/u], fieldFactor : %6.4f, first file : %s, firstRunID : %15i, last file : %s, lastRunID : %15i, system : %s\n", beamID, beamEnergy,fieldFactor, firstFile.Data(),firstRunID, lastFile.Data(),lastRunID, collisionSystem.Data()); } else { // real data TString date1 = HTime::runIdToTimeString(firstRunID,1,kFALSE); TString date2 = HTime::runIdToTimeString(lastRunID ,1,kFALSE); printf("HBeamPar :: BeamID : %5d, BeamEnergy : %5.0f [Mev/u], fieldFactor : %6.4f, first file : %s, firstRunID : %15i (%s), last file : %s, lastRunID : %15i (%s), system : %s\n", beamID, beamEnergy, fieldFactor, firstFile.Data(),firstRunID,date1.Data(), lastFile.Data() ,lastRunID,date2.Data() , collisionSystem.Data()); } } ClassDef(HBeamPar,0) }; class HBeamTime : public TObject { protected: static map mIdToYear; static map mIdToName; static map mIdToRange; static map initBeamTimesYear(); static map initBeamTimesNames(); static map initBeamTimesRange(); static vector vBeamPar; static vector vBeamParSim; static vector initBeamPar(); static vector initBeamParSim(); public: HBeamTime(); static Bool_t checkBeamTimeSettingByRunId(TString msg = "",Bool_t doNotAllowUnknowBeam=kTRUE,Bool_t print=kTRUE); static Bool_t getRunID(Int_t& runid,Bool_t print=kTRUE); static Bool_t getYearFromRunID(Int_t& year,Bool_t print=kTRUE); static time_t dateToTime(TString date); static Bool_t checkBeamTimeID (Int_t,TString msg = "",Bool_t doNotAllowUnknowBeam=kTRUE,Bool_t print=kTRUE); static Bool_t printBeamTimeInfo(Int_t id = -1,TString msg = ""); static Bool_t getBeamTimeRange (Int_t id, time_t& start,time_t& end); static TString getBeamTimeName (Int_t id); static void printBeamPar(); static void printBeamParReal(); static void printBeamParSim (); static Bool_t getBeamPar (Int_t runid,HBeamPar& par); static Bool_t getBeamParReal(Int_t runid,HBeamPar& par); static Bool_t getBeamParSim (Int_t runid,HBeamPar& par); ClassDef(HBeamTime,0) }; #endif // __HBEAMTIME_H__