Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:18

0001 #ifndef SiStripObjects_SiStripDetCabling_h
0002 #define SiStripObjects_SiStripDetCabling_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     CalibFormats/SiStripObjects
0006 // Class  :     SiStripDetCabling
0007 /**\class SiStripDetCabling SiStripDetCabling.h
0008  CalibFormats/SiStripObjects/interface/SiStripDetCabling.h
0009 
0010  Description: give detector view of the cabling of the silicon strip tracker
0011 */
0012 // Original Author:  dkcira
0013 //         Created:  Wed Mar 22 12:24:20 CET 2006
0014 #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
0015 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
0016 #include <map>
0017 #include <string>
0018 #include <vector>
0019 #include <cstdint>
0020 class TrackerTopology;
0021 class SiStripDetCabling {
0022 public:
0023   SiStripDetCabling(const TrackerTopology *const topology);
0024   virtual ~SiStripDetCabling();
0025   SiStripDetCabling(const SiStripFedCabling &, const TrackerTopology *const topology);
0026 
0027   SiStripDetCabling(const SiStripDetCabling &) = delete;
0028   const SiStripDetCabling &operator=(const SiStripDetCabling &) = delete;
0029 
0030   void addDevices(const FedChannelConnection &, std::map<uint32_t, std::vector<const FedChannelConnection *>> &);
0031   void addDevices(const FedChannelConnection &);  // special case of above addDevices
0032   // getters
0033   inline const std::map<uint32_t, std::vector<const FedChannelConnection *>> &getDetCabling() const {
0034     return fullcabling_;
0035   }
0036   // for DQM use: all detectors that have at least one connected APV
0037   void addActiveDetectorsRawIds(
0038       std::vector<uint32_t> &) const;  // add to vector Ids of connected modules (active == connected)
0039   void addAllDetectorsRawIds(
0040       std::vector<uint32_t> &vector_to_fill_with_detids) const;  // add to vector Ids of all modules
0041   void getAllDetectorsContiguousIds(
0042       std::map<uint32_t, unsigned int> &) const;  // map of all connected, detected, undetected to contiguous Ids -
0043                                                   // map is reset first!
0044   void getActiveDetectorsContiguousIds(
0045       std::map<uint32_t, unsigned int> &) const;  // map of all connected to contiguous Ids - map is reset first!
0046   // for RECO use
0047   void addConnected(std::map<uint32_t, std::vector<int>> &)
0048       const;  // map of detector to list of APVs for APVs seen from FECs and FEDs
0049   void addDetected(
0050       std::map<uint32_t, std::vector<int>> &) const;  // map of detector to list of APVs for APVs seen from FECs but not
0051                                                       // from FEDs
0052   void addUnDetected(
0053       std::map<uint32_t, std::vector<int>> &) const;  // map of detector to list of APVs for APVs seen neither from FECS
0054                                                       // or FEDs
0055   void addNotConnectedAPVs(
0056       std::map<uint32_t, std::vector<int>> &) const;  // map of detector to list of APVs that are not connected -
0057                                                       // combination of addDetected and addUnDetected
0058   // other
0059   const std::vector<const FedChannelConnection *> &getConnections(uint32_t det_id) const;
0060   const FedChannelConnection &getConnection(uint32_t det_id, unsigned short apv_pair) const;
0061   const unsigned int getDcuId(uint32_t det_id) const;
0062   const uint16_t nApvPairs(uint32_t det_id) const;  // maximal nr. of apvpairs a detector can have (2 or 3)
0063   bool IsConnected(const uint32_t &det_id) const;
0064   bool IsDetected(const uint32_t &det_id) const;
0065   bool IsUndetected(const uint32_t &det_id) const;
0066 
0067   /** Added missing print method. */
0068   void print(std::stringstream &) const;
0069 
0070   /** The printSummary method outputs the number of
0071    * connected/detected/undetected modules for each layer of each subdetector.*/
0072   void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
0073   /** The printDebug method returns all the connected/detected/undetected
0074    * modules.*/
0075   void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
0076 
0077   // Methods to get the number of connected, detected and undetected modules for
0078   // each layer of each subdetector.
0079   uint32_t connectedNumber(const std::string &subDet, const uint16_t layer) const {
0080     return detNumber(subDet, layer, 0);
0081   }
0082   uint32_t detectedNumber(const std::string &subDet, const uint16_t layer) const { return detNumber(subDet, layer, 1); }
0083   uint32_t undetectedNumber(const std::string &subDet, const uint16_t layer) const {
0084     return detNumber(subDet, layer, 2);
0085   }
0086   inline const SiStripFedCabling *fedCabling() const { return fedCabling_; }
0087   inline const TrackerTopology *const trackerTopology() const { return tTopo; }
0088 
0089   std::map<uint32_t, std::vector<int>> const &connected() const { return connected_; }
0090 
0091 private:
0092   void addFromSpecificConnection(std::map<uint32_t, std::vector<int>> &,
0093                                  const std::map<uint32_t, std::vector<int>> &,
0094                                  std::map<int16_t, uint32_t> *connectionsToFill = nullptr) const;
0095   bool IsInMap(const uint32_t &det_id, const std::map<uint32_t, std::vector<int>> &) const;
0096   int16_t layerSearch(const uint32_t detId) const;
0097   uint32_t detNumber(const std::string &subDet, const uint16_t layer, const int connectionType) const;
0098 
0099   // ---------- member data --------------------------------
0100   // map of KEY=detid DATA=vector<FedChannelConnection>
0101   std::map<uint32_t, std::vector<const FedChannelConnection *>> fullcabling_;
0102   // map of KEY=detid DATA=vector of apvs, maximum 6 APVs per detector module :
0103   // 0,1,2,3,4,5
0104   std::map<uint32_t, std::vector<int>> connected_;   // seen from FECs and FEDs
0105   std::map<uint32_t, std::vector<int>> detected_;    // seen from FECs but not from FEDs
0106   std::map<uint32_t, std::vector<int>> undetected_;  // seen from neither FECs or FEDs, DetIds inferred from
0107                                                      // static Look-Up-Table in the configuration database
0108 
0109   // Map containing the number of detectors for each connectionType
0110   // 0 = connected
0111   // 1 = detected
0112   // 2 = undetected
0113   std::map<int16_t, uint32_t> connectionCount[3];
0114   const SiStripFedCabling *fedCabling_;
0115   const TrackerTopology *const tTopo;
0116 };
0117 #endif