CMS 3D CMS Logo

SiPixelROCsStatusAndMappingWrapperESProducer.cc
Go to the documentation of this file.
1 #include <memory>
2 
13 #include "RecoTracker/Record/interface/CkfComponentsRecord.h" // TODO: eventually use something more limited
14 
16 public:
18  std::unique_ptr<SiPixelROCsStatusAndMappingWrapper> produce(const CkfComponentsRecord& iRecord);
19 
20  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
21 
22 private:
27 };
28 
30  const edm::ParameterSet& iConfig)
31  : useQuality_(iConfig.getParameter<bool>("UseQualityInfo")) {
32  auto const& component = iConfig.getParameter<std::string>("ComponentName");
33  auto cc = setWhatProduced(this, component);
34  cablingMapToken_ = cc.consumes(edm::ESInputTag{"", iConfig.getParameter<std::string>("CablingMapLabel")});
35  if (useQuality_) {
36  qualityToken_ = cc.consumes();
37  }
38  geometryToken_ = cc.consumes();
39 }
40 
43  desc.add<std::string>("ComponentName", "");
44  desc.add<std::string>("CablingMapLabel", "")->setComment("CablingMap label");
45  desc.add<bool>("UseQualityInfo", false);
46  descriptions.addWithDefaultLabel(desc);
47 }
48 
49 std::unique_ptr<SiPixelROCsStatusAndMappingWrapper> SiPixelROCsStatusAndMappingWrapperESProducer::produce(
50  const CkfComponentsRecord& iRecord) {
51  auto cablingMap = iRecord.getTransientHandle(cablingMapToken_);
52 
53  const SiPixelQuality* quality = nullptr;
54  if (useQuality_) {
55  auto qualityInfo = iRecord.getTransientHandle(qualityToken_);
56  quality = qualityInfo.product();
57  }
58 
59  auto geom = iRecord.getTransientHandle(geometryToken_);
60 
61  return std::make_unique<SiPixelROCsStatusAndMappingWrapper>(*cablingMap, *geom, quality);
62 }
63 
67 
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< SiPixelROCsStatusAndMappingWrapper > produce(const CkfComponentsRecord &iRecord)
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > qualityToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
string quality