CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
SiPixelFEDChannelContainer Class Reference

#include <SiPixelFEDChannelContainer.h>

Public Types

typedef std::unordered_map< std::string, SiPixelFEDChannelCollectionSiPixelBadFEDChannelsScenarioMap
 
typedef std::map< DetId, std::vector< PixelFEDChannel > > SiPixelFEDChannelCollection
 

Public Member Functions

std::unique_ptr< PixelFEDChannelCollectiongetDetSetBadPixelFedChannels (const std::string &ScenarioId) const
 
std::vector< std::string > getScenarioList () const
 
const SiPixelBadFEDChannelsScenarioMapgetScenarioMap () const
 
SiPixelFEDChannelCollection getSiPixelBadFedChannels (const std::string &ScenarioId) const
 
const SiPixelFEDChannelCollectiongetSiPixelBadFedChannels (const std::string &ScenarioId)
 
const std::vector< PixelFEDChannel > & getSiPixelBadFedChannelsInDetId (const std::string &theScenarioId, DetId theDetId)
 
void print (std::ostream &os) const
 
void printAll () const
 
void setScenario (const std::string &theScenarioId, const SiPixelFEDChannelCollection &theBadFEDChannels)
 
 SiPixelFEDChannelContainer ()
 
 SiPixelFEDChannelContainer (const SiPixelFEDChannelContainer &rhs)
 
double size () const
 
virtual ~SiPixelFEDChannelContainer ()
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

SiPixelBadFEDChannelsScenarioMap m_scenarioMap
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 12 of file SiPixelFEDChannelContainer.h.

Member Typedef Documentation

◆ SiPixelBadFEDChannelsScenarioMap

Definition at line 15 of file SiPixelFEDChannelContainer.h.

◆ SiPixelFEDChannelCollection

Definition at line 14 of file SiPixelFEDChannelContainer.h.

Constructor & Destructor Documentation

◆ SiPixelFEDChannelContainer() [1/2]

SiPixelFEDChannelContainer::SiPixelFEDChannelContainer ( )
inline

Definition at line 17 of file SiPixelFEDChannelContainer.h.

17 {}

◆ SiPixelFEDChannelContainer() [2/2]

SiPixelFEDChannelContainer::SiPixelFEDChannelContainer ( const SiPixelFEDChannelContainer rhs)
inline

Definition at line 18 of file SiPixelFEDChannelContainer.h.

References getScenarioMap(), and m_scenarioMap.

18 { m_scenarioMap = rhs.getScenarioMap(); };
SiPixelBadFEDChannelsScenarioMap m_scenarioMap
const SiPixelBadFEDChannelsScenarioMap & getScenarioMap() const

◆ ~SiPixelFEDChannelContainer()

virtual SiPixelFEDChannelContainer::~SiPixelFEDChannelContainer ( )
inlinevirtual

Definition at line 19 of file SiPixelFEDChannelContainer.h.

19 {}

Member Function Documentation

◆ getDetSetBadPixelFedChannels()

std::unique_ptr< PixelFEDChannelCollection > SiPixelFEDChannelContainer::getDetSetBadPixelFedChannels ( const std::string &  ScenarioId) const

Definition at line 65 of file SiPixelFEDChannelContainer.cc.

References mps_splice::entry, Exception, and m_scenarioMap.

66  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap

◆ getScenarioList()

std::vector< std::string > SiPixelFEDChannelContainer::getScenarioList ( ) const

Definition at line 121 of file SiPixelFEDChannelContainer.cc.

References m_scenarioMap, and visualization-live-secondInstance_cfg::scenarios.

Referenced by SiPixelBadFEDChannelSimulationSanityChecker::analyze().

121  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap

◆ getScenarioMap()

const SiPixelBadFEDChannelsScenarioMap& SiPixelFEDChannelContainer::getScenarioMap ( ) const
inline

◆ getSiPixelBadFedChannels() [1/2]

SiPixelFEDChannelContainer::SiPixelFEDChannelCollection SiPixelFEDChannelContainer::getSiPixelBadFedChannels ( const std::string &  ScenarioId) const

Definition at line 20 of file SiPixelFEDChannelContainer.cc.

References Exception, and m_scenarioMap.

21  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap

◆ getSiPixelBadFedChannels() [2/2]

const SiPixelFEDChannelContainer::SiPixelFEDChannelCollection & SiPixelFEDChannelContainer::getSiPixelBadFedChannels ( const std::string &  ScenarioId)

Definition at line 33 of file SiPixelFEDChannelContainer.cc.

References Exception, and m_scenarioMap.

34  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap

◆ getSiPixelBadFedChannelsInDetId()

const std::vector< PixelFEDChannel > & SiPixelFEDChannelContainer::getSiPixelBadFedChannelsInDetId ( const std::string &  theScenarioId,
DetId  theDetId 
)

Definition at line 46 of file SiPixelFEDChannelContainer.cc.

References Exception, spr::find(), and m_scenarioMap.

47  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ print()

void SiPixelFEDChannelContainer::print ( std::ostream &  os) const

Definition at line 106 of file SiPixelFEDChannelContainer.cc.

References mps_splice::entry, and m_scenarioMap.

Referenced by operator<<().

106  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap
Definition: DetId.h:17

◆ printAll()

void SiPixelFEDChannelContainer::printAll ( ) const

Definition at line 84 of file SiPixelFEDChannelContainer.cc.

References mps_splice::entry, and m_scenarioMap.

Referenced by SiPixelFEDChannelContainerTestReader::analyze(), and SiPixelFEDChannelContainerWriteFromASCII::analyze().

84  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap
Log< level::Info, true > LogVerbatim
Definition: DetId.h:17

◆ serialize()

template<class Archive >
void SiPixelFEDChannelContainer::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setScenario()

void SiPixelFEDChannelContainer::setScenario ( const std::string &  theScenarioId,
const SiPixelFEDChannelCollection theBadFEDChannels 
)

Definition at line 8 of file SiPixelFEDChannelContainer.cc.

References m_scenarioMap.

Referenced by SiPixelFEDChannelContainerWriteFromASCII::analyze(), and SiPixelFEDChannelContainerWriteFromASCII::endJob().

9  {
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 }
SiPixelBadFEDChannelsScenarioMap m_scenarioMap
Log< level::Warning, false > LogWarning

◆ size()

double SiPixelFEDChannelContainer::size ( void  ) const
inline

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 43 of file SiPixelFEDChannelContainer.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 43 of file SiPixelFEDChannelContainer.h.

Member Data Documentation

◆ m_scenarioMap

SiPixelBadFEDChannelsScenarioMap SiPixelFEDChannelContainer::m_scenarioMap
private