00001 #ifndef SLOWCONTROLMANAGER_HH 00002 #define SLOWCONTROLMANAGER_HH 00003 00004 00005 00006 #include "mTypes.h" 00007 #include <map> 00008 #include <list> 00009 #include <set> 00010 #include <fstream> 00011 #include "SlowControlEntry.hh" 00012 00013 class SteerDesc; 00014 class ChamberParams; 00015 class PMParams; 00016 class SCSteerParams; 00017 class ChamberSlowControl; 00018 class MeshParams_t; 00019 class PMSlowControl; 00020 class DriftParams_t; 00021 00022 struct scSorter 00023 { 00024 bool operator() (const SlowControlEntry& lhs, const SlowControlEntry& rhs) const 00025 { 00026 return lhs.timeStamp > rhs.timeStamp; // du plus grand au plus petit 00027 } 00028 }; 00029 00030 ////////////////////////////////////////////////////////////////////////// 00031 /// CLASS SLOWCONTROL // 00032 ////////////////////////////////////////////////////////////////////////// 00033 class SlowControlManager { 00034 // friend std::ostream& operator <<(std::ostream &out, const Event &x); 00035 00036 public: 00037 SlowControlManager(); 00038 ~SlowControlManager(); 00039 i32 ReadDB(const std::string fileName); 00040 void build(const SteerDesc& sd); // builds reading structure from steer file 00041 00042 // general parameters 00043 const SlowControlEntry* getEntry(const double timeStamp)const ; 00044 std::set<SlowControlEntry>::const_iterator begin() { return genList.begin(); }; 00045 std::set<SlowControlEntry>::const_iterator end() { return genList.end(); }; 00046 00047 /* 00048 // chamber parameters 00049 ChamberParams& getChamberData(const ui32 id, const double timeStamp); 00050 std::map<i32,ChamberParams&>& getChamberData(const double timeStamp); 00051 00052 // photomultiplier parameters 00053 PMParams& getPMData(const ui32 id, const double timeStamp); 00054 */ 00055 00056 private: 00057 void addSteer(const ui32 scId, const std::string type, const ui32 id, const std::string name); 00058 00059 // general parameters 00060 void addEntry(const SlowControlEntry& entry); 00061 00062 // chamber parameters 00063 const ChamberSlowControl& getChamber(const double timeStamp, const ui32 id) const ; 00064 const ChamberSlowControl& getPM(const double timeStamp, const ui32 id) const ; 00065 00066 /* 00067 void addChamber(const std::string name, const ui32 id); 00068 ChamberSlowControl& getChamber(const ui32 id); 00069 ChamberSlowControl& getChamber(const std::string name); 00070 void addChamberData(ChamberSlowControl& chamber, const double timeStamp, const MeshParams_t& aMesh, const DriftParams_t& aDrift); 00071 00072 // Photomultiplier parameters 00073 void addPM(const std::string name, const ui32 id); 00074 PMSlowControl& getPM(const ui32 id); 00075 PMSlowControl& getPM(const std::string name); 00076 void addPMData(const PMSlowControl& pm, const double timeStamp, const float v1, const float v2); 00077 */ 00078 private: 00079 // Stocked data by timestamp 00080 //std::list<SlowControlEntry> genList; // a general parameter by timestamp 00081 std::set<SlowControlEntry,scSorter> genList; // contains all slowcontrol sorted by their timestamp 00082 //std::list<SlowControlEntry> genList; // a general parameter by timestamp 00083 // std::map<i32, ChamberSlowControl> chMap; // a map element by chamber ( ref by chamber id ) 00084 // std::list<PMSlowControl> PMList; 00085 00086 // For steer file data comprehension 00087 std::list<SCSteerParams> stList; 00088 }; 00089 00090 00091 #endif 00092