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 
31 
32 // Need to add #include statements for definitions of
33 // the data type and record type here
34 
35 //
36 // class declaration
37 //
38 
40  public:
43 
44  typedef std::unordered_map<std::string,PixelFEDChannelCollection> PixelFEDChannelCollectionMap;
45  using ReturnType = std::unique_ptr<PixelFEDChannelCollectionMap>;
46 
48  private:
49  // ----------member data ---------------------------
50 };
51 
52 
54 {
55  //the following line is needed to tell the framework what
56  // data is being produced
57  setWhatProduced(this);
58 
59  //now do what ever other initialization is needed
60 }
61 
62 
64 {
65 
66  // do anything here that needs to be done at destruction time
67  // (e.g. close files, deallocate resources etc.)
68 
69 }
70 
71 //
72 // member functions
73 //
74 
75 // ------------ method called to produce the data ------------
78 {
79  edm::ESHandle<SiPixelFEDChannelContainer> qualityCollectionHandle;
80  iRecord.getRecord<SiPixelStatusScenariosRcd>().get(qualityCollectionHandle);
81 
83 
84  for(const auto& it : qualityCollectionHandle->getScenarioMap()){
85 
86  std::string scenario = it.first;
87  PixelFEDChannelCollection disabled_channelcollection;
88  auto SiPixelBadFedChannels = it.second;
89  for(const auto &entry : SiPixelBadFedChannels){
90  disabled_channelcollection.insert(entry.first, entry.second.data(), entry.second.size());
91  }
92  out.emplace(scenario,disabled_channelcollection);
93  }
94 
95  auto product = std::make_unique<PixelFEDChannelCollectionMap>(out);
96  return product;
97 }
98 
99 //define this as a plug-in
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116
ReturnType produce(const SiPixelFEDChannelContainerESProducerRcd &)
std::unordered_map< std::string, PixelFEDChannelCollection > PixelFEDChannelCollectionMap
const SiPixelBadFEDChannelsScenarioMap & getScenarioMap() const
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 &)