CMS 3D CMS Logo

SiStripDetCabling.h
Go to the documentation of this file.
1 #ifndef SiStripObjects_SiStripDetCabling_h
2 #define SiStripObjects_SiStripDetCabling_h
3 // -*- C++ -*-
4 //
5 // Package: CalibFormats/SiStripObjects
6 // Class : SiStripDetCabling
12 // Original Author: dkcira
13 // Created: Wed Mar 22 12:24:20 CET 2006
16 #include <map>
17 #include <string>
18 #include <vector>
19 #include <cstdint>
20 class TrackerTopology;
22 public:
23  SiStripDetCabling(const TrackerTopology *const topology);
24  virtual ~SiStripDetCabling();
25  SiStripDetCabling(const SiStripFedCabling &, const TrackerTopology *const topology);
26 
27  SiStripDetCabling(const SiStripDetCabling &) = delete;
28  const SiStripDetCabling &operator=(const SiStripDetCabling &) = delete;
29 
30  void addDevices(const FedChannelConnection &, std::map<uint32_t, std::vector<const FedChannelConnection *>> &);
31  void addDevices(const FedChannelConnection &); // special case of above addDevices
32  // getters
33  inline const std::map<uint32_t, std::vector<const FedChannelConnection *>> &getDetCabling() const {
34  return fullcabling_;
35  }
36  // for DQM use: all detectors that have at least one connected APV
38  std::vector<uint32_t> &) const; // add to vector Ids of connected modules (active == connected)
40  std::vector<uint32_t> &vector_to_fill_with_detids) const; // add to vector Ids of all modules
42  std::map<uint32_t, unsigned int> &) const; // map of all connected, detected, undetected to contiguous Ids -
43  // map is reset first!
45  std::map<uint32_t, unsigned int> &) const; // map of all connected to contiguous Ids - map is reset first!
46  // for RECO use
47  void addConnected(std::map<uint32_t, std::vector<int>> &)
48  const; // map of detector to list of APVs for APVs seen from FECs and FEDs
49  void addDetected(
50  std::map<uint32_t, std::vector<int>> &) const; // map of detector to list of APVs for APVs seen from FECs but not
51  // from FEDs
52  void addUnDetected(
53  std::map<uint32_t, std::vector<int>> &) const; // map of detector to list of APVs for APVs seen neither from FECS
54  // or FEDs
56  std::map<uint32_t, std::vector<int>> &) const; // map of detector to list of APVs that are not connected -
57  // combination of addDetected and addUnDetected
58  // other
59  const std::vector<const FedChannelConnection *> &getConnections(uint32_t det_id) const;
60  const FedChannelConnection &getConnection(uint32_t det_id, unsigned short apv_pair) const;
61  const unsigned int getDcuId(uint32_t det_id) const;
62  const uint16_t nApvPairs(uint32_t det_id) const; // maximal nr. of apvpairs a detector can have (2 or 3)
63  bool IsConnected(const uint32_t &det_id) const;
64  bool IsDetected(const uint32_t &det_id) const;
65  bool IsUndetected(const uint32_t &det_id) const;
66 
68  void print(std::stringstream &) const;
69 
72  void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
75  void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
76 
77  // Methods to get the number of connected, detected and undetected modules for
78  // each layer of each subdetector.
79  uint32_t connectedNumber(const std::string &subDet, const uint16_t layer) const {
80  return detNumber(subDet, layer, 0);
81  }
82  uint32_t detectedNumber(const std::string &subDet, const uint16_t layer) const { return detNumber(subDet, layer, 1); }
83  uint32_t undetectedNumber(const std::string &subDet, const uint16_t layer) const {
84  return detNumber(subDet, layer, 2);
85  }
86  inline const SiStripFedCabling *fedCabling() const { return fedCabling_; }
87  inline const TrackerTopology *const trackerTopology() const { return tTopo; }
88 
89  std::map<uint32_t, std::vector<int>> const &connected() const { return connected_; }
90 
91 private:
92  void addFromSpecificConnection(std::map<uint32_t, std::vector<int>> &,
93  const std::map<uint32_t, std::vector<int>> &,
94  std::map<int16_t, uint32_t> *connectionsToFill = nullptr) const;
95  bool IsInMap(const uint32_t &det_id, const std::map<uint32_t, std::vector<int>> &) const;
96  int16_t layerSearch(const uint32_t detId) const;
97  uint32_t detNumber(const std::string &subDet, const uint16_t layer, const int connectionType) const;
98 
99  // ---------- member data --------------------------------
100  // map of KEY=detid DATA=vector<FedChannelConnection>
101  std::map<uint32_t, std::vector<const FedChannelConnection *>> fullcabling_;
102  // map of KEY=detid DATA=vector of apvs, maximum 6 APVs per detector module :
103  // 0,1,2,3,4,5
104  std::map<uint32_t, std::vector<int>> connected_; // seen from FECs and FEDs
105  std::map<uint32_t, std::vector<int>> detected_; // seen from FECs but not from FEDs
106  std::map<uint32_t, std::vector<int>> undetected_; // seen from neither FECs or FEDs, DetIds inferred from
107  // static Look-Up-Table in the configuration database
108 
109  // Map containing the number of detectors for each connectionType
110  // 0 = connected
111  // 1 = detected
112  // 2 = undetected
113  std::map<int16_t, uint32_t> connectionCount[3];
115  const TrackerTopology *const tTopo;
116 };
117 #endif
void addDetected(std::map< uint32_t, std::vector< int >> &) const
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
const unsigned int getDcuId(uint32_t det_id) const
void addConnected(std::map< uint32_t, std::vector< int >> &) const
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
std::map< uint32_t, std::vector< const FedChannelConnection * > > fullcabling_
uint32_t detectedNumber(const std::string &subDet, const uint16_t layer) const
std::map< uint32_t, std::vector< int > > const & connected() const
bool IsUndetected(const uint32_t &det_id) const
const std::map< uint32_t, std::vector< const FedChannelConnection * > > & getDetCabling() const
void addNotConnectedAPVs(std::map< uint32_t, std::vector< int >> &) const
bool IsConnected(const uint32_t &det_id) const
int16_t layerSearch(const uint32_t detId) const
uint32_t undetectedNumber(const std::string &subDet, const uint16_t layer) const
const SiStripFedCabling * fedCabling_
const FedChannelConnection & getConnection(uint32_t det_id, unsigned short apv_pair) const
const SiStripFedCabling * fedCabling() const
bool IsInMap(const uint32_t &det_id, const std::map< uint32_t, std::vector< int >> &) const
Class containning control, module, detector and connection information, at the level of a FED channel...
const SiStripDetCabling & operator=(const SiStripDetCabling &)=delete
void print(std::stringstream &) const
void getAllDetectorsContiguousIds(std::map< uint32_t, unsigned int > &) const
void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector< const FedChannelConnection *>> &)
std::map< uint32_t, std::vector< int > > connected_
virtual ~SiStripDetCabling()
bool IsDetected(const uint32_t &det_id) const
void getActiveDetectorsContiguousIds(std::map< uint32_t, unsigned int > &) const
std::map< uint32_t, std::vector< int > > detected_
void addUnDetected(std::map< uint32_t, std::vector< int >> &) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
std::map< uint32_t, std::vector< int > > undetected_
void addFromSpecificConnection(std::map< uint32_t, std::vector< int >> &, const std::map< uint32_t, std::vector< int >> &, std::map< int16_t, uint32_t > *connectionsToFill=nullptr) const
void addAllDetectorsRawIds(std::vector< uint32_t > &vector_to_fill_with_detids) const
const TrackerTopology *const tTopo
std::map< int16_t, uint32_t > connectionCount[3]
const TrackerTopology *const trackerTopology() const
uint32_t connectedNumber(const std::string &subDet, const uint16_t layer) const
SiStripDetCabling(const TrackerTopology *const topology)
const uint16_t nApvPairs(uint32_t det_id) const
uint32_t detNumber(const std::string &subDet, const uint16_t layer, const int connectionType) const
void addActiveDetectorsRawIds(std::vector< uint32_t > &) const