00001 00012 #ifndef _CHANNELMANAGER_HH_ 00013 #define _CHANNELMANAGER_HH_ 00014 00015 #include <map> 00016 #include <vector> 00017 #include "QVector.hh" 00018 #include "QMatrix.hh" 00019 #include <TObject.h> 00020 00021 #include "QCuore.hh" 00022 #include "QError.hh" 00023 00024 using namespace Cuore; 00025 00026 class ChannelManager { 00027 00028 public: 00029 00030 00040 struct ChProperty { 00041 bool isActive; 00042 bool isMasked; 00043 double ref; 00044 double refMin; 00045 double refMax; 00046 }; 00047 00048 00054 ChannelManager(const std::vector<int>& boloList, const std::vector<int>& activeChannels); 00055 00061 ChannelManager(const std::vector<int>& boloList, const std::vector<int>& activeChannels, const std::multimap<int,int>& FloorChannel); 00067 virtual ~ChannelManager(); 00073 QError SetMasked(const std::vector<int>& maskedList); 00079 QError SetMasked(const QMatrix& matrix); 00085 QError SetMasked(int ch, bool isMasked = true); 00091 QError SetReference(int ch, double ref, double refmin, double refmax); 00097 QError SetReference(const QMatrix& matrix); 00103 bool GetIsMasked(int ch) const {if(fChannels.find(ch) != fChannels.end()) return fChannels.find(ch)->second.isMasked; else return false;} 00109 bool GetIsActive(int ch) const {if(fChannels.find(ch) != fChannels.end()) return fChannels.find(ch)->second.isActive; else return false;} 00115 ChProperty GetChannelProperty(int ch) const {if(fChannels.find(ch) != fChannels.end()) return fChannels.find(ch)->second;} 00121 std::vector<ChProperty> GetActiveChannels(bool isActive = true); 00127 std::vector<ChProperty> GetMasked(bool isMasked = true); 00133 QError GetReference(int ch, double &ref, double &RefMin, double &RefMax); 00134 00135 double GetMaxReference(); 00145 std::map<std::string, TObject*> CreateReferencePlot(char * VariableName, const QVector & VariableValue, const int binSeparation); 00146 00147 00148 00149 private: 00155 std::map<int, ChProperty> fChannels; 00156 std::multimap<int,int> fFloorChannel; 00157 00158 }; 00159 00160 #endif