Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DTReadOutMapping_H
0002 #define DTReadOutMapping_H
0003 /** \class DTReadOutMapping
0004  *
0005  *  Description:
0006  *       Class to map read-out channels to physical drift tubes
0007  *       Many details related to this class are described in
0008  *       internal note IN 2010_033. In particular the compact
0009  *       format is described there.
0010  *
0011  *  \author Paolo Ronchese INFN Padova
0012  *
0013  */
0014 
0015 //----------------------
0016 // Base Class Headers --
0017 //----------------------
0018 
0019 //------------------------------------
0020 // Collaborating Class Declarations --
0021 //------------------------------------
0022 #include "CondFormats/Serialization/interface/Serializable.h"
0023 
0024 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0025 #include "DataFormats/Common/interface/AtomicPtrCache.h"
0026 #include "FWCore/Utilities/interface/ConstRespectingPtr.h"
0027 
0028 //---------------
0029 // C++ Headers --
0030 //---------------
0031 #include <vector>
0032 #include <string>
0033 
0034 class DTReadOutMappingCache;
0035 template <class Key, class Content>
0036 class DTBufferTree;
0037 
0038 //              ---------------------
0039 //              -- Class Interface --
0040 //              ---------------------
0041 
0042 class DTReadOutGeometryLink {
0043 public:
0044   DTReadOutGeometryLink();
0045   ~DTReadOutGeometryLink();
0046 
0047   int dduId;
0048   int rosId;
0049   int robId;
0050   int tdcId;
0051   int channelId;
0052   int wheelId;
0053   int stationId;
0054   int sectorId;
0055   int slId;
0056   int layerId;
0057   int cellId;
0058 
0059   COND_SERIALIZABLE;
0060 };
0061 
0062 class DTReadOutMapping {
0063 public:
0064   /** Constructor
0065    */
0066   DTReadOutMapping();
0067   DTReadOutMapping(DTReadOutMapping const&) = delete;
0068   DTReadOutMapping& operator=(DTReadOutMapping const&) = delete;
0069   DTReadOutMapping(const std::string& cell_map_version, const std::string& rob_map_version);
0070 
0071   /** Destructor
0072    */
0073   ~DTReadOutMapping();
0074 
0075   enum type { plain, compact };
0076 
0077   /** Operations
0078    */
0079   /// transform identifiers
0080   int readOutToGeometry(int dduId, int rosId, int robId, int tdcId, int channelId, DTWireId& wireId) const;
0081 
0082   int readOutToGeometry(int dduId,
0083                         int rosId,
0084                         int robId,
0085                         int tdcId,
0086                         int channelId,
0087                         int& wheelId,
0088                         int& stationId,
0089                         int& sectorId,
0090                         int& slId,
0091                         int& layerId,
0092                         int& cellId) const;
0093 
0094   int geometryToReadOut(int wheelId,
0095                         int stationId,
0096                         int sectorId,
0097                         int slId,
0098                         int layerId,
0099                         int cellId,
0100                         int& dduId,
0101                         int& rosId,
0102                         int& robId,
0103                         int& tdcId,
0104                         int& channelId) const;
0105   int geometryToReadOut(const DTWireId& wireId, int& dduId, int& rosId, int& robId, int& tdcId, int& channelId) const;
0106 
0107   type mapType() const;
0108 
0109   /// access parent maps identifiers
0110   const std::string& mapCellTdc() const;
0111   std::string& mapCellTdc();
0112   const std::string& mapRobRos() const;
0113   std::string& mapRobRos();
0114 
0115   /// clear map
0116   void clear();
0117 
0118   /// insert connection
0119   int insertReadOutGeometryLink(int dduId,
0120                                 int rosId,
0121                                 int robId,
0122                                 int tdcId,
0123                                 int channelId,
0124                                 int wheelId,
0125                                 int stationId,
0126                                 int sectorId,
0127                                 int slId,
0128                                 int layerId,
0129                                 int cellId);
0130 
0131   /// Access methods to the connections
0132   typedef std::vector<DTReadOutGeometryLink>::const_iterator const_iterator;
0133   const_iterator begin() const;
0134   const_iterator end() const;
0135 
0136   /// Expand to full map
0137   const DTReadOutMapping* fullMap() const;
0138 
0139 private:
0140   edm::AtomicPtrCache<DTReadOutMappingCache> const& atomicCache() const { return atomicCache_; }
0141   edm::AtomicPtrCache<DTReadOutMappingCache>& atomicCache() { return atomicCache_; }
0142 
0143   static DTReadOutMapping* expandMap(const DTReadOutMapping& compMap);
0144 
0145   std::string cellMapVersion;
0146   std::string robMapVersion;
0147 
0148   std::vector<DTReadOutGeometryLink> readOutChannelDriftTubeMap;
0149 
0150   edm::AtomicPtrCache<DTReadOutMappingCache> atomicCache_ COND_TRANSIENT;
0151   edm::ConstRespectingPtr<DTBufferTree<int, int> > rgBuf COND_TRANSIENT;
0152   edm::ConstRespectingPtr<DTBufferTree<int, int> > grBuf COND_TRANSIENT;
0153 
0154   /// read and store full content
0155   void cacheMap() const;
0156 
0157   std::string mapNameRG() const;
0158   std::string mapNameGR() const;
0159 
0160   COND_SERIALIZABLE;
0161 };
0162 #endif  // DTReadOutMapping_H