00001 #ifndef SETUPRECORD_H 00002 #define SETUPRECORD_H 00003 00004 #include <IdChannel.h> 00005 00006 class TSetupData; 00007 //EventNavigator; 00008 00012 class SetupRecord { 00013 public: 00014 friend class EventNavigator; 00015 typedef IDs::channel ChannelID; 00016 00018 struct BankInfo_t { 00020 Double_t TickLength; 00023 Double_t LinearWidthLSB; 00026 Double_t LinearZeroPoint; 00028 Double_t TimeFromMuSc; 00030 ChannelID ID; 00032 Short_t ADCDepth; 00034 Short_t Pedestal; 00036 Short_t Polarity; 00038 char Name[5]; 00040 Char_t Enabled; 00041 00043 void Print() const; 00044 }; 00045 00047 virtual ~SetupRecord(); 00048 00050 inline Double_t GetTickLength(const ChannelID& cid) const 00051 { return BankInfo(cid).TickLength; } 00052 00054 inline Double_t GetTimeFromMuSc(const ChannelID& cid) const 00055 { return BankInfo(cid).TimeFromMuSc; } 00056 00058 inline Short_t GetADCDepth(const ChannelID& cid) const 00059 { return BankInfo(cid).ADCDepth; } 00060 00062 inline Int_t GetOverflowADC(const ChannelID& cid) const 00063 { return (1 << GetADCDepth(cid)); } 00064 00066 inline Int_t GetMaxADC(const ChannelID& cid) const 00067 { return GetOverflowADC(cid) -1; } 00068 00070 inline Short_t GetPedestal(const ChannelID& cid) const 00071 { return BankInfo(cid).Pedestal; } 00072 00076 inline Short_t GetHeadroom(const ChannelID& cid) const 00077 { return GetMaxADC(cid) - GetPedestal(cid); } 00078 00080 inline Short_t GetPolarity(const ChannelID& cid) const 00081 { return BankInfo(cid).Polarity; } 00082 00084 inline Bool_t IsEnabled(const ChannelID& cid) const 00085 { return static_cast<Bool_t>(BankInfo(cid).Enabled); } 00086 00088 inline std::string GetBankName(const ChannelID& cid) const 00089 { return BankFromChannel(cid); } 00090 00092 std::string BankFromChannel(const ChannelID& cid) const 00093 { return std::string(BankInfo(cid).Name); } 00094 00096 ChannelID ChannelFromBank(const std::string& bankname) const 00097 { return BankInfo(bankname).ID; } 00098 00099 protected: 00101 const BankInfo_t& BankInfo(const std::string& bankname) const; 00102 00104 const BankInfo_t& BankInfo(const ChannelID& cid) const; 00105 00107 BankInfo_t& BankInfo(const std::string& bankname); 00108 00110 BankInfo_t& BankInfo(const ChannelID& cid); 00111 00113 SetupRecord(const TSetupData* setup_data); 00114 00116 SetupRecord(); 00117 00119 SetupRecord(const SetupRecord& src); 00120 00122 SetupRecord& operator=(const SetupRecord& rhs); 00123 00125 int InitChannels(const TSetupData* setup_data); 00126 00128 int InitMetaData(const TSetupData* setup_data); 00129 00130 private: 00132 std::vector<BankInfo_t> fInfoLookup; 00133 00135 std::map<ChannelID, UInt_t> fIDOrderLookup; 00136 00138 std::map<std::string, UInt_t> fNameOrderLookup; 00139 }; 00140 00141 #endif //SETUPRECORD_H