Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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