File indexing completed on 2024-04-06 11:58:18
0001 #ifndef SiStripObjects_SiStripDetCabling_h
0002 #define SiStripObjects_SiStripDetCabling_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
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 &);
0032
0033 inline const std::map<uint32_t, std::vector<const FedChannelConnection *>> &getDetCabling() const {
0034 return fullcabling_;
0035 }
0036
0037 void addActiveDetectorsRawIds(
0038 std::vector<uint32_t> &) const;
0039 void addAllDetectorsRawIds(
0040 std::vector<uint32_t> &vector_to_fill_with_detids) const;
0041 void getAllDetectorsContiguousIds(
0042 std::map<uint32_t, unsigned int> &) const;
0043
0044 void getActiveDetectorsContiguousIds(
0045 std::map<uint32_t, unsigned int> &) const;
0046
0047 void addConnected(std::map<uint32_t, std::vector<int>> &)
0048 const;
0049 void addDetected(
0050 std::map<uint32_t, std::vector<int>> &) const;
0051
0052 void addUnDetected(
0053 std::map<uint32_t, std::vector<int>> &) const;
0054
0055 void addNotConnectedAPVs(
0056 std::map<uint32_t, std::vector<int>> &) const;
0057
0058
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;
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
0068 void print(std::stringstream &) const;
0069
0070
0071
0072 void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
0073
0074
0075 void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const;
0076
0077
0078
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
0100
0101 std::map<uint32_t, std::vector<const FedChannelConnection *>> fullcabling_;
0102
0103
0104 std::map<uint32_t, std::vector<int>> connected_;
0105 std::map<uint32_t, std::vector<int>> detected_;
0106 std::map<uint32_t, std::vector<int>> undetected_;
0107
0108
0109
0110
0111
0112
0113 std::map<int16_t, uint32_t> connectionCount[3];
0114 const SiStripFedCabling *fedCabling_;
0115 const TrackerTopology *const tTopo;
0116 };
0117 #endif