Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DTMtime_H
0002 #define DTMtime_H
0003 /** \class DTMtime
0004  *
0005  *  Description:
0006  *       Class to hold drift tubes mean-times
0007  *             ( SL by SL mean-time calculation )
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 "CondFormats/DTObjects/interface/DTTimeUnits.h"
0023 #include "CondFormats/DTObjects/interface/DTVelocityUnits.h"
0024 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0025 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
0026 #include "FWCore/Utilities/interface/ConstRespectingPtr.h"
0027 
0028 //---------------
0029 // C++ Headers --
0030 //---------------
0031 #include <string>
0032 #include <vector>
0033 #include <utility>
0034 
0035 template <class Key, class Content>
0036 class DTBufferTree;
0037 
0038 //              ---------------------
0039 //              -- Class Interface --
0040 //              ---------------------
0041 
0042 class DTMtimeId {
0043 public:
0044   DTMtimeId();
0045   ~DTMtimeId();
0046 
0047   int wheelId;
0048   int stationId;
0049   int sectorId;
0050   int slId;
0051   int layerId;
0052   int cellId;
0053 
0054   COND_SERIALIZABLE;
0055 };
0056 
0057 class DTMtimeData {
0058 public:
0059   DTMtimeData();
0060   ~DTMtimeData();
0061 
0062   float mTime;
0063   float mTrms;
0064 
0065   COND_SERIALIZABLE;
0066 };
0067 
0068 class DTMtime {
0069 public:
0070   /** Constructor
0071    */
0072   DTMtime();
0073   DTMtime(DTMtime const&) = delete;
0074   DTMtime& operator=(DTMtime const&) = delete;
0075   DTMtime(const std::string& version);
0076 
0077   /** Destructor
0078    */
0079   ~DTMtime();
0080 
0081   /** Operations
0082    */
0083   /// get content
0084   int slMtime(
0085       int wheelId, int stationId, int sectorId, int slId, float& mTime, float& mTrms, DTTimeUnits::type unit) const {
0086     return get(wheelId, stationId, sectorId, slId, 0, 0, mTime, mTrms, unit);
0087   };
0088   int slMtime(int wheelId,
0089               int stationId,
0090               int sectorId,
0091               int slId,
0092               int layerId,
0093               int cellId,
0094               float& mTime,
0095               float& mTrms,
0096               DTTimeUnits::type unit) const {
0097     return get(wheelId, stationId, sectorId, slId, layerId, cellId, mTime, mTrms, unit);
0098   };
0099   int slMtime(const DTSuperLayerId& id, float& mTime, float& mTrms, DTTimeUnits::type unit) const {
0100     return get(id, mTime, mTrms, unit);
0101   };
0102   int slMtime(const DetId& id, float& mTime, float& mTrms, DTTimeUnits::type unit) const {
0103     return get(id, mTime, mTrms, unit);
0104   };
0105   int get(int wheelId, int stationId, int sectorId, int slId, float& mTime, float& mTrms, DTTimeUnits::type unit) const;
0106   int get(
0107       int wheelId, int stationId, int sectorId, int slId, float& mTime, float& mTrms, DTVelocityUnits::type unit) const;
0108   int get(int wheelId,
0109           int stationId,
0110           int sectorId,
0111           int slId,
0112           int layerId,
0113           int cellId,
0114           float& mTime,
0115           float& mTrms,
0116           DTTimeUnits::type unit) const;
0117   int get(int wheelId,
0118           int stationId,
0119           int sectorId,
0120           int slId,
0121           int layerId,
0122           int cellId,
0123           float& mTime,
0124           float& mTrms,
0125           DTVelocityUnits::type unit) const;
0126   int get(const DTSuperLayerId& id, float& mTime, float& mTrms, DTTimeUnits::type unit) const;
0127   int get(const DTSuperLayerId& id, float& mTime, float& mTrms, DTVelocityUnits::type unit) const;
0128   int get(const DetId& id, float& mTime, float& mTrms, DTTimeUnits::type unit) const;
0129   int get(const DetId& id, float& mTime, float& mTrms, DTVelocityUnits::type unit) const;
0130   float unit() const;
0131 
0132   /// access version
0133   const std::string& version() const;
0134   std::string& version();
0135 
0136   /// reset content
0137   void clear();
0138 
0139   int setSLMtime(int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTTimeUnits::type unit) {
0140     return set(wheelId, stationId, sectorId, slId, 0, 0, mTime, mTrms, unit);
0141   };
0142   int setSLMtime(int wheelId,
0143                  int stationId,
0144                  int sectorId,
0145                  int slId,
0146                  int layerId,
0147                  int cellId,
0148                  float mTime,
0149                  float mTrms,
0150                  DTTimeUnits::type unit) {
0151     return set(wheelId, stationId, sectorId, slId, layerId, cellId, mTime, mTrms, unit);
0152   };
0153   int setSLMtime(const DTSuperLayerId& id, float mTime, float mTrms, DTTimeUnits::type unit) {
0154     return set(id, mTime, mTrms, unit);
0155   };
0156   int setSLMtime(const DetId& id, float mTime, float mTrms, DTTimeUnits::type unit) {
0157     return set(id, mTime, mTrms, unit);
0158   };
0159   int set(int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTTimeUnits::type unit);
0160   int set(int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTVelocityUnits::type unit);
0161   int set(int wheelId,
0162           int stationId,
0163           int sectorId,
0164           int slId,
0165           int layerId,
0166           int cellId,
0167           float mTime,
0168           float mTrms,
0169           DTTimeUnits::type unit);
0170   int set(int wheelId,
0171           int stationId,
0172           int sectorId,
0173           int slId,
0174           int layerId,
0175           int cellId,
0176           float mTime,
0177           float mTrms,
0178           DTVelocityUnits::type unit);
0179   int set(const DTSuperLayerId& id, float mTime, float mTrms, DTTimeUnits::type unit);
0180   int set(const DTSuperLayerId& id, float mTime, float mTrms, DTVelocityUnits::type unit);
0181   int set(const DetId& id, float mTime, float mTrms, DTTimeUnits::type unit);
0182   int set(const DetId& id, float mTime, float mTrms, DTVelocityUnits::type unit);
0183   void setUnit(float unit);
0184 
0185   /// Access methods to data
0186   typedef std::vector<std::pair<DTMtimeId, DTMtimeData> >::const_iterator const_iterator;
0187   const_iterator begin() const;
0188   const_iterator end() const;
0189 
0190   void initialize();
0191 
0192 private:
0193   std::string dataVersion;
0194   float nsPerCount;
0195 
0196   std::vector<std::pair<DTMtimeId, DTMtimeData> > dataList;
0197 
0198   edm::ConstRespectingPtr<DTBufferTree<int, int> > dBuf COND_TRANSIENT;
0199 
0200   /// read and store full content
0201   std::string mapName() const;
0202 
0203   COND_SERIALIZABLE;
0204 };
0205 #endif  // DTMtime_H