Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:55

0001 #ifndef CondFormats_CSCTriggerMapping_h
0002 #define CondFormats_CSCTriggerMapping_h
0003 
0004 /** 
0005  * \class CSCTriggerMapping
0006  * \author Lindsey Gray (taken from T. Cox's design)
0007  * Abstract class to define mapping between CSC Trigger Hardware labels and
0008  * geometry labels. Basically this amounts to a cabling scheme.
0009  *
0010  * Defines the ids and labels in the mapping and supplies tramslation interface.
0011  * A derived class must define how hardware labels map to a unique integer.
0012  * A derived, concrete, class must define from where the mapping information comes.
0013  */
0014 
0015 //@@ FIXME This whole design would better suit a Factory/Builder pattern
0016 
0017 #include "CondFormats/Serialization/interface/Serializable.h"
0018 
0019 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
0020 #include <vector>
0021 #include <map>
0022 
0023 class CSCTriggerMapping {
0024 public:
0025   /// Default constructor
0026   CSCTriggerMapping();
0027 
0028   /// Destructor
0029   virtual ~CSCTriggerMapping();
0030 
0031   /**
0032    * Instead of a set of vectors of int use one vector of a set of ints
0033    * Defines a connection between a chamber on a disc and a readout label. 
0034    * This is equivalent to the placement of a board in a crate, and a MPC to SR/SP 
0035    * optical connection.
0036    * Construction of CSCDetIds is done using CSCTriggerNumbering.
0037    * 
0038    * variables with a 'r' prefix are readout-derived labels
0039    * variables with a 'c' prefix are geometry-derived labels (c as in chamber label)
0040    * \warning ALL LABELS ARE TRIGGER LABELS. PLEASE ACCOUNT FOR THIS!!!
0041    */
0042   typedef struct CSCTriggerConnection {
0043     CSCTriggerConnection() {}
0044     CSCTriggerConnection(int rendcap,
0045                          int rstation,
0046                          int rsector,
0047                          int rsubsector,
0048                          int rcscid,
0049                          int cendcap,
0050                          int cstation,
0051                          int csector,
0052                          int csubsector,
0053                          int ccscid)
0054         : rendcap_(rendcap),
0055           rstation_(rstation),
0056           rsector_(rsector),
0057           rsubsector_(rsubsector),
0058           rcscid_(rcscid),
0059           cendcap_(cendcap),
0060           cstation_(cstation),
0061           csector_(csector),
0062           csubsector_(csubsector),
0063           ccscid_(ccscid) {}
0064     ~CSCTriggerConnection() {}
0065 
0066     int rendcap_;
0067     int rstation_;
0068     int rsector_;
0069     int rsubsector_;
0070     int rcscid_;
0071     int cendcap_;
0072     int cstation_;
0073     int csector_;
0074     int csubsector_;
0075     int ccscid_;
0076 
0077     COND_SERIALIZABLE;
0078   } Connection;
0079 
0080   /**
0081     * Return CSCDetId for chamber/layer corresponding to readout ids station, sector, subsector and 
0082     * cscid for given endcap and layer no. 1-6, or for chamber if no layer no. supplied.
0083     * Args: endcap = 1 (+z), 2 (-z), station, readout sector, readout subsector, readout cscid, layer#
0084     */
0085   // layer at end so it can have default arg
0086   CSCDetId detId(int endcap, int station, int sector, int subsector, int cscid, int layer = 0) const;
0087 
0088   /** 
0089     * Return chamber label corresponding to readout ids station, sector, subsector and cscid for given endcap
0090     *  endcap = 1 (+z), 2 (-z), station, sector, subsector, cscid (dmb slot/2)
0091     */
0092   int chamber(int endcap, int station, int sector, int subsector, int cscid) const;
0093 
0094   /** 
0095     * Fill mapping store
0096     */
0097   virtual void fill(void) = 0;
0098 
0099   /**
0100     * Add one record of info to mapping
0101     */
0102   void addRecord(int rendcap,
0103                  int rstation,
0104                  int rsector,
0105                  int rsubsector,
0106                  int rcscid,
0107                  int cendcap,
0108                  int cstation,
0109                  int csector,
0110                  int csubsector,
0111                  int ccscid);
0112 
0113   /**
0114      * Set debug printout flag
0115      */
0116   void setDebugV(bool dbg) { debugV_ = dbg; }
0117 
0118   /**
0119      * Status of debug printout flag
0120      */
0121   bool debugV(void) const { return debugV_; }
0122 
0123   /**
0124      * Return class name
0125      */
0126   const std::string& myName(void) const { return myName_; }
0127 
0128 private:
0129   /**
0130      * Build a unique integer out of the readout electronics labels.
0131      *
0132      */
0133   virtual int hwId(int endcap, int station, int sector, int subsector, int cscid) const = 0;
0134 
0135   /**
0136      * Build a unique integer out of chamber labels.
0137      *
0138      * Translate to geometry labels then use rawId.
0139      */
0140   int swId(int endcap, int station, int sector, int subsector, int cscid) const;
0141 
0142   std::string myName_ COND_TRANSIENT;
0143   bool debugV_ COND_TRANSIENT;
0144   std::vector<Connection> mapping_;
0145   std::map<int, int> hw2sw_ COND_TRANSIENT;
0146 
0147   COND_SERIALIZABLE;
0148 };
0149 
0150 #endif