CMS 3D CMS Logo

SiPixelQualityESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelQualityESProducer
4 // Class: SiPixelQualityESProducer
5 //
13 //
14 // Original Author: Gemma Tinti
15 // Created: Jan 13 2011
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 #include <cassert>
22 
23 // user include files
39 
40 using namespace edm;
41 
43 public:
45  ~SiPixelQualityESProducer() override;
46 
47  std::unique_ptr<SiPixelQuality> produce(const SiPixelQualityRcd& iRecord);
48  std::unique_ptr<SiPixelQuality> produceWithLabel(const SiPixelQualityRcd& iRecord);
49 
50 private:
51  void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
52  const edm::IOVSyncValue&,
53  edm::ValidityInterval&) override;
54 
55  struct Tokens {
56  Tokens() = default;
58  voffToken_ = cc.consumes();
59  dbobjectToken_ = cc.consumes(edm::ESInputTag{"", label});
60  }
63  };
64 
65  std::unique_ptr<SiPixelQuality> get_pointer(const SiPixelQualityRcd& iRecord, const Tokens& tokens);
66 
69 };
70 
71 //
72 // constructors and destructor
73 //
74 
76  : defaultTokens_(setWhatProduced(this), "") {
77  edm::LogInfo("SiPixelQualityESProducer::SiPixelQualityESProducer");
78 
79  auto label =
80  conf_.exists("siPixelQualityLabel") ? conf_.getParameter<std::string>("siPixelQualityLabel") : std::string{};
81 
82  if (label == "forDigitizer") {
83  labelTokens_ =
85  }
86  findingRecord<SiPixelQualityRcd>();
87 }
88 
90  // do anything here that needs to be done at desctruction time
91  // (e.g. close files, deallocate resources etc.)
92 }
93 
94 std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::get_pointer(const SiPixelQualityRcd& iRecord,
95  const Tokens& tokens) {
97  // errortype "whole" = int 0 in DB BadRocs = 65535 //
98  // errortype "tbmA" = int 1 in DB BadRocs = 255 //
99  // errortype "tbmB" = int 2 in DB Bad Rocs = 65280 //
100  // errortype "none" = int 3 in DB //
102 
103  //if I have understood this is the one got from the DB or file, but in any case the ORIGINAL(maybe i need to get the record for it)
104  //SiPixelQuality * obj = new SiPixelQuality();
105  //SiPixelQuality::disabledModuleType BadModule;
106  //BadModule.DetID = 1; BadModule.errorType = 0; BadModule.BadRocs = 65535; obj->addDisabledModule(BadModule);
107 
108  //now the dbobject is the one copied from the db
109  auto dbptr = std::make_unique<SiPixelQuality>(iRecord.get(tokens.dbobjectToken_));
110 
111  //here is the magic line in which it switches off Bad Modules
112  dbptr->add(&(iRecord.get(tokens.voffToken_)));
113  return dbptr;
114 }
115 
116 std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produce(const SiPixelQualityRcd& iRecord) {
117  return get_pointer(iRecord, defaultTokens_);
118 }
119 std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produceWithLabel(const SiPixelQualityRcd& iRecord) {
120  return get_pointer(iRecord, labelTokens_);
121 }
122 
124  const edm::IOVSyncValue& iosv,
125  edm::ValidityInterval& oValidity) {
127  oValidity = infinity;
128 }
129 
SiPixelQualityESProducer
Definition: SiPixelQualityESProducer.cc:42
SiStripDependentRecords.h
SiPixelQualityESProducer::produce
std::unique_ptr< SiPixelQuality > produce(const SiPixelQualityRcd &iRecord)
Definition: SiPixelQualityESProducer.cc:116
edm::ESInputTag
Definition: ESInputTag.h:87
MessageLogger.h
TrackerGeometry.h
SiPixelQualityRcd
Definition: SiPixelQualityRcd.h:13
edm::ESConsumesCollector
Definition: ESConsumesCollector.h:61
edm
HLT enums.
Definition: AlignableModifier.h:19
SiPixelQualityESProducer::Tokens
Definition: SiPixelQualityESProducer.cc:55
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ValidityInterval
Definition: ValidityInterval.h:28
ESProducer.h
SiPixelQualityESProducer::SiPixelQualityESProducer
SiPixelQualityESProducer(const edm::ParameterSet &iConfig)
Definition: SiPixelQualityESProducer.cc:75
SiPixelQualityESProducer::~SiPixelQualityESProducer
~SiPixelQualityESProducer() override
Definition: SiPixelQualityESProducer.cc:89
SiPixelQualityFromDbRcd.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
infinity
const double infinity
Definition: CSCChamberFitter.cc:10
edm::EventSetupRecordIntervalFinder
Definition: EventSetupRecordIntervalFinder.h:33
SiPixelQualityESProducer::get_pointer
std::unique_ptr< SiPixelQuality > get_pointer(const SiPixelQualityRcd &iRecord, const Tokens &tokens)
Definition: SiPixelQualityESProducer.cc:94
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
cc
SiPixelQualityRcd.h
SiPixelQualityESProducer::setIntervalFor
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Definition: SiPixelQualityESProducer.cc:123
edm::es::Label
Definition: es_Label.h:56
SiPixelQualityESProducer::Tokens::Tokens
Tokens(edm::ESConsumesCollector cc, const std::string &label)
Definition: SiPixelQualityESProducer.cc:57
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
SiPixelQualityESProducer::Tokens::voffToken_
edm::ESGetToken< SiStripDetVOff, SiPixelDetVOffRcd > voffToken_
Definition: SiPixelQualityESProducer.cc:61
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
EventSetupRecordIntervalFinder.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiPixelQualityESProducer::produceWithLabel
std::unique_ptr< SiPixelQuality > produceWithLabel(const SiPixelQualityRcd &iRecord)
Definition: SiPixelQualityESProducer.cc:119
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
TrackerDigiGeometryRecord.h
SiPixelQualityESProducer::labelTokens_
Tokens labelTokens_
Definition: SiPixelQualityESProducer.cc:68
edm::ParameterSet
Definition: ParameterSet.h:47
edm::IOVSyncValue::endOfTime
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
SiPixelQualityESProducer::Tokens::dbobjectToken_
edm::ESGetToken< SiPixelQuality, SiPixelQualityFromDbRcd > dbobjectToken_
Definition: SiPixelQualityESProducer.cc:62
edm::ESGetToken< SiStripDetVOff, SiPixelDetVOffRcd >
SiPixelDetInfoFileReader.h
ModuleFactory.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::IOVSyncValue::beginOfTime
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
SiPixelQuality.h
edm::ESProducer
Definition: ESProducer.h:104
ParameterSet.h
SiStripDetVOff.h
SiPixelQualityESProducer::defaultTokens_
const Tokens defaultTokens_
Definition: SiPixelQualityESProducer.cc:67
label
const char * label
Definition: PFTauDecayModeTools.cc:11