CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PixelFEDChannelCollectionProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CalibTracker/PixelFEDChannelCollectionProducer
4 // Class: PixelFEDChannelCollectionProducer
5 //
13 //
14 // Original Author: Marco Musich
15 // Created: Thu, 13 Dec 2018 08:48:22 GMT
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
26 
30 
31 // Need to add #include statements for definitions of
32 // the data type and record type here
33 
34 //
35 // class declaration
36 //
37 
39 public:
42 
43  typedef std::unordered_map<std::string, PixelFEDChannelCollection> PixelFEDChannelCollectionMap;
44  using ReturnType = std::unique_ptr<PixelFEDChannelCollectionMap>;
45 
47 
48 private:
49  // ----------member data ---------------------------
51 };
52 
54  : qualityToken_(setWhatProduced(this).consumes()) {}
55 
57  // do anything here that needs to be done at destruction time
58  // (e.g. close files, deallocate resources etc.)
59 }
60 
61 //
62 // member functions
63 //
64 
65 // ------------ method called to produce the data ------------
68  const auto& qualityCollection = iRecord.get(qualityToken_);
69 
70  auto out = std::make_unique<PixelFEDChannelCollectionMap>();
71 
72  for (const auto& it : qualityCollection.getScenarioMap()) {
73  const std::string& scenario = it.first;
74  // getScenarioMap() is an unordered_map<string, ...>, so each scenario appears exactly once
75  PixelFEDChannelCollection& disabled_channelcollection = (*out)[scenario];
76 
77  const auto& SiPixelBadFedChannels = it.second;
78  for (const auto& entry : SiPixelBadFedChannels) {
79  disabled_channelcollection.insert(entry.first, entry.second.data(), entry.second.size());
80  }
81  }
82 
83  return out;
84 }
85 
86 //define this as a plug-in
ReturnType produce(const SiPixelFEDChannelContainerESProducerRcd &)
scenario
Definition: constants.h:173
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const edm::ESGetToken< SiPixelFEDChannelContainer, SiPixelStatusScenariosRcd > qualityToken_
DetSet insert(id_type iid, data_type const *idata, size_type isize)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::unique_ptr< PixelFEDChannelCollectionMap > ReturnType
PixelFEDChannelCollectionProducer(const edm::ParameterSet &)
list entry
Definition: mps_splice.py:68
std::unordered_map< std::string, PixelFEDChannelCollection > PixelFEDChannelCollectionMap