CMS 3D CMS Logo

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  //the following line is needed to tell the framework what
55  // data is being produced
56  setWhatProduced(this).setConsumes(qualityToken_);
57 
58  //now do what ever other initialization is needed
59 }
60 
62  // do anything here that needs to be done at destruction time
63  // (e.g. close files, deallocate resources etc.)
64 }
65 
66 //
67 // member functions
68 //
69 
70 // ------------ method called to produce the data ------------
73  const auto& qualityCollection = iRecord.get(qualityToken_);
74 
75  auto out = std::make_unique<PixelFEDChannelCollectionMap>();
76 
77  for (const auto& it : qualityCollection.getScenarioMap()) {
78  const std::string& scenario = it.first;
79  // getScenarioMap() is an unordered_map<string, ...>, so each scenario appears exactly once
80  PixelFEDChannelCollection& disabled_channelcollection = (*out)[scenario];
81 
82  const auto& SiPixelBadFedChannels = it.second;
83  for (const auto& entry : SiPixelBadFedChannels) {
84  disabled_channelcollection.insert(entry.first, entry.second.data(), entry.second.size());
85  }
86  }
87 
88  return out;
89 }
90 
91 //define this as a plug-in
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ReturnType produce(const SiPixelFEDChannelContainerESProducerRcd &)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
DetSet insert(id_type iid, data_type const *idata, size_type isize)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::ESGetToken< SiPixelFEDChannelContainer, SiPixelStatusScenariosRcd > qualityToken_
std::unique_ptr< PixelFEDChannelCollectionMap > ReturnType
PixelFEDChannelCollectionProducer(const edm::ParameterSet &)
std::unordered_map< std::string, PixelFEDChannelCollection > PixelFEDChannelCollectionMap