CMS 3D CMS Logo

SiPixelFEDChannelContainer.cc
Go to the documentation of this file.
4 #include <iostream>
5 #include <iomanip> // std::setw
6 
7 //****************************************************************************//
9  const SiPixelFEDChannelCollection &theBadFEDChannels) {
10  if (m_scenarioMap.find(theScenarioId) != m_scenarioMap.end()) {
11  edm::LogWarning("SiPixelFEDChannelContainer")
12  << "Scenario: " << theScenarioId << " is already in the map!" << std::endl;
13  return;
14  } else {
15  m_scenarioMap.emplace(theScenarioId, theBadFEDChannels);
16  }
17 }
18 
19 //****************************************************************************//
21  const std::string &theScenarioId) const {
22  SiPixelBadFEDChannelsScenarioMap::const_iterator it = m_scenarioMap.find(theScenarioId);
23 
24  if (it != m_scenarioMap.end()) {
25  return it->second;
26  } else {
27  throw cms::Exception("SiPixelFEDChannelContainer")
28  << "No Bad Pixel FEDChannels defined for Scenario id: " << theScenarioId << "\n";
29  }
30 }
31 
32 //****************************************************************************//
34  const std::string &theScenarioId) {
35  SiPixelBadFEDChannelsScenarioMap::const_iterator it = m_scenarioMap.find(theScenarioId);
36 
37  if (it != m_scenarioMap.end()) {
38  return it->second;
39  } else {
40  throw cms::Exception("SiPixelFEDChannelContainer")
41  << "No Bad Pixel FEDChannels defined for Scenario id: " << theScenarioId << "\n";
42  }
43 }
44 
45 //****************************************************************************//
47  const std::string &theScenarioId, DetId theDetId) {
48  SiPixelBadFEDChannelsScenarioMap::const_iterator it = m_scenarioMap.find(theScenarioId);
49 
50  if (it == m_scenarioMap.end()) {
51  throw cms::Exception("SiPixelFEDChannelContainer")
52  << "No Bad Pixel FEDChannels defined for Scenario id: " << theScenarioId << "\n";
53  } else {
54  SiPixelFEDChannelCollection::const_iterator it2 = (it->second).find(theDetId);
55 
56  if (it2 == (it->second).end()) {
57  throw cms::Exception("SiPixelFEDChannelContainer")
58  << "No Bad Pixel FEDChannels defined for DetId:" << theDetId << " in Scenario id: " << theScenarioId << "\n";
59  }
60  return it2->second;
61  }
62 }
63 
64 //****************************************************************************//
65 std::unique_ptr<PixelFEDChannelCollection> SiPixelFEDChannelContainer::getDetSetBadPixelFedChannels(
66  const std::string &theScenarioId) const {
67  SiPixelBadFEDChannelsScenarioMap::const_iterator it = m_scenarioMap.find(theScenarioId);
68 
69  if (it == m_scenarioMap.end()) {
70  throw cms::Exception("SiPixelFEDChannelContainer")
71  << "No Bad Pixel FEDChannels defined for Scenario id: " << theScenarioId << "\n";
72  }
73 
74  std::unique_ptr<PixelFEDChannelCollection> disabled_channelcollection =
75  std::make_unique<edmNew::DetSetVector<PixelFEDChannel> >();
76  auto SiPixelBadFedChannels = it->second;
77  for (const auto &entry : SiPixelBadFedChannels) {
78  disabled_channelcollection->insert(entry.first, entry.second.data(), entry.second.size());
79  }
80  return disabled_channelcollection;
81 }
82 
83 //****************************************************************************//
85  edm::LogVerbatim("SiPixelFEDChannelContainer") << "SiPixelFEDChannelContainer::printAll()";
86  edm::LogVerbatim("SiPixelFEDChannelContainer") << " ================================================================="
87  "==================================================";
88  for (auto it = m_scenarioMap.begin(); it != m_scenarioMap.end(); ++it) {
89  edm::LogVerbatim("SiPixelFEDChannelContainer") << "run :" << it->first << " \n ";
90  for (const auto &thePixelFEDChannel : it->second) {
91  DetId detId = thePixelFEDChannel.first;
92 
93  edm::LogVerbatim("SiPixelFEDChannelContainer") << "DetId :" << detId << " \n ";
94 
95  for (const auto &entry : thePixelFEDChannel.second) {
96  //unsigned int fed, link, roc_first, roc_last;
97  edm::LogVerbatim("SiPixelFEDChannelContainer")
98  << " fed : " << entry.fed << " link : " << entry.link << " roc_first : " << entry.roc_first
99  << " roc_last: : " << entry.roc_last;
100  }
101  }
102  }
103 }
104 
105 //****************************************************************************//
106 void SiPixelFEDChannelContainer::print(std::ostream &os) const {
107  for (auto it = m_scenarioMap.begin(); it != m_scenarioMap.end(); ++it) {
108  os << "run :" << it->first << " \n ";
109  for (const auto &thePixelFEDChannel : it->second) {
110  DetId detId = thePixelFEDChannel.first;
111  os << "DetId :" << detId << " \n ";
112  for (const auto &entry : thePixelFEDChannel.second) {
113  os << " fed : " << entry.fed << " link : " << entry.link << " roc_first : " << entry.roc_first
114  << " roc_last: : " << entry.roc_last;
115  }
116  }
117  }
118 }
119 
120 //****************************************************************************//
121 std::vector<std::string> SiPixelFEDChannelContainer::getScenarioList() const {
122  std::vector<std::string> scenarios;
123  scenarios.reserve(m_scenarioMap.size());
124 
125  for (auto it = m_scenarioMap.begin(); it != m_scenarioMap.end(); ++it) {
126  scenarios.push_back(it->first);
127  }
128  return scenarios;
129 }
130 
131 //****************************************************************************//
132 std::ostream &operator<<(std::ostream &os, SiPixelFEDChannelContainer FEDChannels) {
133  std::stringstream ss;
134  FEDChannels.print(ss);
135  os << ss.str();
136  return os;
137 }
MessageLogger.h
mps_splice.entry
entry
Definition: mps_splice.py:68
SiPixelFEDChannelContainer
Definition: SiPixelFEDChannelContainer.h:12
SiPixelFEDChannelContainer.h
SiPixelFEDChannelContainer::SiPixelFEDChannelCollection
std::map< DetId, std::vector< PixelFEDChannel > > SiPixelFEDChannelCollection
Definition: SiPixelFEDChannelContainer.h:14
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
visualization-live-secondInstance_cfg.scenarios
scenarios
Definition: visualization-live-secondInstance_cfg.py:22
operator<<
std::ostream & operator<<(std::ostream &os, SiPixelFEDChannelContainer FEDChannels)
Definition: SiPixelFEDChannelContainer.cc:132
SiPixelFEDChannelContainer::getSiPixelBadFedChannels
SiPixelFEDChannelCollection getSiPixelBadFedChannels(const std::string &ScenarioId) const
Definition: SiPixelFEDChannelContainer.cc:20
SiPixelFEDChannelContainer::getSiPixelBadFedChannelsInDetId
const std::vector< PixelFEDChannel > & getSiPixelBadFedChannelsInDetId(const std::string &theScenarioId, DetId theDetId)
Definition: SiPixelFEDChannelContainer.cc:46
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
SiPixelFEDChannelContainer::getDetSetBadPixelFedChannels
std::unique_ptr< PixelFEDChannelCollection > getDetSetBadPixelFedChannels(const std::string &ScenarioId) const
Definition: SiPixelFEDChannelContainer.cc:65
Exception
Definition: hltDiff.cc:245
SiPixelFEDChannelContainer::getScenarioList
std::vector< std::string > getScenarioList() const
Definition: SiPixelFEDChannelContainer.cc:121
SiPixelFEDChannelContainer::print
void print(std::ostream &os) const
Definition: SiPixelFEDChannelContainer.cc:106
Exception.h
SiPixelFEDChannelContainer::printAll
void printAll() const
Definition: SiPixelFEDChannelContainer.cc:84
SiPixelFEDChannelContainer::setScenario
void setScenario(const std::string &theScenarioId, const SiPixelFEDChannelCollection &theBadFEDChannels)
Definition: SiPixelFEDChannelContainer.cc:8
SiPixelFEDChannelContainer::m_scenarioMap
SiPixelBadFEDChannelsScenarioMap m_scenarioMap
Definition: SiPixelFEDChannelContainer.h:41