Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:06

0001 #ifndef DTStatusFlag_H
0002 #define DTStatusFlag_H
0003 /** \class DTStatusFlag
0004  *
0005  *  Description:
0006  *       Class to hold drift tubes status
0007  *             ( cell by cell noise and masks )
0008  *
0009  *  \author Paolo Ronchese INFN Padova
0010  *
0011  */
0012 
0013 //----------------------
0014 // Base Class Headers --
0015 //----------------------
0016 
0017 //------------------------------------
0018 // Collaborating Class Declarations --
0019 //------------------------------------
0020 #include "CondFormats/Serialization/interface/Serializable.h"
0021 
0022 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0023 #include "FWCore/Utilities/interface/ConstRespectingPtr.h"
0024 
0025 //---------------
0026 // C++ Headers --
0027 //---------------
0028 #include <string>
0029 #include <vector>
0030 #include <utility>
0031 
0032 template <class Key, class Content>
0033 class DTBufferTree;
0034 
0035 //              ---------------------
0036 //              -- Class Interface --
0037 //              ---------------------
0038 
0039 class DTStatusFlagId {
0040 public:
0041   DTStatusFlagId();
0042   ~DTStatusFlagId();
0043 
0044   int wheelId;
0045   int stationId;
0046   int sectorId;
0047   int slId;
0048   int layerId;
0049   int cellId;
0050 
0051   COND_SERIALIZABLE;
0052 };
0053 
0054 class DTStatusFlagData {
0055 public:
0056   DTStatusFlagData();
0057   ~DTStatusFlagData();
0058 
0059   bool noiseFlag;
0060   bool feMask;
0061   bool tdcMask;
0062   bool trigMask;
0063   bool deadFlag;
0064   bool nohvFlag;
0065 
0066   COND_SERIALIZABLE;
0067 };
0068 
0069 class DTStatusFlagCompare {
0070 public:
0071   bool operator()(const DTStatusFlagId& idl, const DTStatusFlagId& idr) const;
0072 };
0073 
0074 class DTStatusFlag {
0075 public:
0076   /** Constructor
0077    */
0078   DTStatusFlag();
0079   DTStatusFlag(DTStatusFlag const&) = delete;
0080   DTStatusFlag& operator=(DTStatusFlag const&) = delete;
0081   DTStatusFlag(const std::string& version);
0082 
0083   /** Destructor
0084    */
0085   ~DTStatusFlag();
0086 
0087   /** Operations
0088    */
0089   /// get content
0090   int cellStatus(int wheelId,
0091                  int stationId,
0092                  int sectorId,
0093                  int slId,
0094                  int layerId,
0095                  int cellId,
0096                  bool& noiseFlag,
0097                  bool& feMask,
0098                  bool& tdcMask,
0099                  bool& trigMask,
0100                  bool& deadFlag,
0101                  bool& nohvFlag) const {
0102     return get(
0103         wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
0104   };
0105   int cellStatus(const DTWireId& id,
0106                  bool& noiseFlag,
0107                  bool& feMask,
0108                  bool& tdcMask,
0109                  bool& trigMask,
0110                  bool& deadFlag,
0111                  bool& nohvFlag) const {
0112     return get(id, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
0113   };
0114   int get(int wheelId,
0115           int stationId,
0116           int sectorId,
0117           int slId,
0118           int layerId,
0119           int cellId,
0120           bool& noiseFlag,
0121           bool& feMask,
0122           bool& tdcMask,
0123           bool& trigMask,
0124           bool& deadFlag,
0125           bool& nohvFlag) const;
0126   int get(const DTWireId& id,
0127           bool& noiseFlag,
0128           bool& feMask,
0129           bool& tdcMask,
0130           bool& trigMask,
0131           bool& deadFlag,
0132           bool& nohvFlag) const;
0133 
0134   /// access version
0135   const std::string& version() const;
0136   std::string& version();
0137 
0138   /// reset content
0139   void clear();
0140 
0141   int setCellStatus(int wheelId,
0142                     int stationId,
0143                     int sectorId,
0144                     int slId,
0145                     int layerId,
0146                     int cellId,
0147                     bool noiseFlag,
0148                     bool feMask,
0149                     bool tdcMask,
0150                     bool trigMask,
0151                     bool deadFlag,
0152                     bool nohvFlag) {
0153     return set(
0154         wheelId, stationId, sectorId, slId, layerId, cellId, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
0155   };
0156   int setCellStatus(
0157       const DTWireId& id, bool noiseFlag, bool feMask, bool tdcMask, bool trigMask, bool deadFlag, bool nohvFlag) {
0158     return set(id, noiseFlag, feMask, tdcMask, trigMask, deadFlag, nohvFlag);
0159   };
0160 
0161   int set(int wheelId,
0162           int stationId,
0163           int sectorId,
0164           int slId,
0165           int layerId,
0166           int cellId,
0167           bool noiseFlag,
0168           bool feMask,
0169           bool tdcMask,
0170           bool trigMask,
0171           bool deadFlag,
0172           bool nohvFlag);
0173   int set(const DTWireId& id, bool noiseFlag, bool feMask, bool tdcMask, bool trigMask, bool deadFlag, bool nohvFlag);
0174 
0175   int setCellNoise(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag);
0176   int setCellNoise(const DTWireId& id, bool flag);
0177 
0178   int setCellFEMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask);
0179   int setCellFEMask(const DTWireId& id, bool mask);
0180 
0181   int setCellTDCMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask);
0182   int setCellTDCMask(const DTWireId& id, bool mask);
0183 
0184   int setCellTrigMask(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool mask);
0185   int setCellTrigMask(const DTWireId& id, bool mask);
0186 
0187   int setCellDead(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag);
0188   int setCellDead(const DTWireId& id, bool flag);
0189 
0190   int setCellNoHV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag);
0191   int setCellNoHV(const DTWireId& id, bool flag);
0192 
0193   /// Access methods to data
0194   typedef std::vector<std::pair<DTStatusFlagId, DTStatusFlagData> >::const_iterator const_iterator;
0195   const_iterator begin() const;
0196   const_iterator end() const;
0197 
0198   void initialize();
0199 
0200 private:
0201   std::string dataVersion;
0202 
0203   std::vector<std::pair<DTStatusFlagId, DTStatusFlagData> > dataList;
0204 
0205   edm::ConstRespectingPtr<DTBufferTree<int, int> > dBuf COND_TRANSIENT;
0206 
0207   std::string mapName() const;
0208 
0209   COND_SERIALIZABLE;
0210 };
0211 #endif  // DTStatusFlag_H