CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
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 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
uint32_t const *__restrict__ Quality * quality
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::unique_ptr< SiPixelROCsStatusAndMappingWrapper > produce(const CkfComponentsRecord &iRecord)
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > qualityToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_