CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/CondFormats/CSCObjects/interface/CSCReadoutMapping.h

Go to the documentation of this file.
00001 #ifndef CondFormats_CSCReadoutMapping_h
00002 #define CondFormats_CSCReadoutMapping_h
00003 
00014 //@@ FIXME This whole design would better suit a Factory/Builder pattern
00015 
00016 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
00017 #include <vector>
00018 #include <map>
00019 
00020 namespace edm {
00021   class ParameterSet;
00022 }
00023 
00024 class CSCReadoutMapping {
00025  public:
00026 
00028   CSCReadoutMapping();
00029 
00031   virtual ~CSCReadoutMapping();
00032 
00036   struct CSCLabel{
00037     CSCLabel(){}
00038     CSCLabel( int endcap, int station, int ring, int chamber,  
00039               int vmecrate, int dmb, int tmb, int tsector, int cscid, int ddu, int dcc )
00040       : endcap_( endcap ), station_( station ), ring_( ring ), chamber_( chamber ),
00041          vmecrate_( vmecrate ), dmb_( dmb ), tmb_( tmb ), 
00042          tsector_( tsector ), cscid_( cscid ), ddu_(ddu), dcc_(dcc) {}
00043     ~CSCLabel(){}
00044 
00045     int endcap_;
00046     int station_;
00047     int ring_;
00048     int chamber_;
00049     int vmecrate_;
00050     int dmb_;
00051     int tmb_;
00052     int tsector_;
00053     int cscid_;
00054     int ddu_;
00055     int dcc_;
00056   };
00057 
00064     // layer at end so it can have default arg
00065   CSCDetId detId( int endcap, int station, int vmecrate, int dmb, int tmb, int cfeb, int layer = 0 ) const;
00066 
00071   int chamber( int endcap, int station, int vmecrate, int dmb, int tmb ) const;
00072 
00076   virtual void fill( const edm::ParameterSet& ) = 0;
00077 
00079   CSCLabel findHardwareId(const CSCDetId&) const;
00081   int crate(const CSCDetId&) const;
00083   int dmbId(const CSCDetId&) const;
00085   int dccId(const CSCDetId&) const;
00087   int dduId(const CSCDetId&) const;
00088 
00089 
00093     void addRecord( int endcap, int station, int ring, int chamber, 
00094                     int vmecrate, int dmb, int tmb, int tsector, int cscid, int ddu, int dcc ); 
00095 
00099     void setDebugV( bool dbg ) { debugV_ = dbg; }
00100 
00104     bool debugV( void ) const { return debugV_; }
00105 
00109     const std::string& myName( void ) const { return myName_; }
00110 
00111  private: 
00112 
00119     virtual int hwId( int endcap, int station, int vme, int dmb, int tmb ) const = 0;
00120 
00126     int swId( int endcap, int station, int ring, int chamber) const;
00127 
00128     std::string myName_;
00129     bool debugV_;
00130     std::vector< CSCLabel > mapping_;
00131     std::map< int, int > hw2sw_;
00132     std::map< int, CSCLabel > sw2hw_;
00133 
00134 };
00135 
00136 #endif