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 // user include files
20 
21 #include <cassert>
33 //
34 // constructors and destructor
35 //
36 using namespace edm;
37 
39  : //fp_(conf_.getParameter<edm::FileInPath>("file")),
40  label(conf_.exists("siPixelQualityLabel")?conf_.getParameter<std::string>("siPixelQualityLabel"):""),
41  toGet(conf_.getParameter<Parameters>("ListOfRecordToMerge"))
42 {
43  edm::LogInfo("SiPixelQualityESProducer::SiPixelQualityESProducer");
44  //the following line is needed to tell the framework what
45  // data is being produced
46  setWhatProduced(this);
47  if (label == "forDigitizer"){
49  }
50  findingRecord<SiPixelQualityRcd>();
51 }
52 
54 {
55 
56  // do anything here that needs to be done at desctruction time
57  // (e.g. close files, deallocate resources etc.)
58 
59 }
60 
61 std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::get_pointer(const SiPixelQualityRcd & iRecord, std::string label){
62 
63 
65 
67  // errortype "whole" = int 0 in DB BadRocs = 65535 //
68  // errortype "tbmA" = int 1 in DB BadRocs = 255 //
69  // errortype "tbmB" = int 2 in DB Bad Rocs = 65280 //
70  // errortype "none" = int 3 in DB //
72 
73  //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)
74  //SiPixelQuality * obj = new SiPixelQuality();
75  //SiPixelQuality::disabledModuleType BadModule;
76  //BadModule.DetID = 1; BadModule.errorType = 0; BadModule.BadRocs = 65535; obj->addDisabledModule(BadModule);
77 
78  //start with the record thta existed already to decouple the debugging
79  //here i can do whatever i need with the detVoff
80 
83 
84  for( Parameters::iterator itToGet = toGet.begin(); itToGet != toGet.end(); ++itToGet ) {
85 
86  recordName = itToGet->getParameter<std::string>("record");
87 
88  if (recordName=="SiPixelDetVOffRcd")
89  iRecord.getRecord<SiPixelDetVOffRcd>().get(Voff);
90  if (recordName=="SiPixelQualityFromDbRcd"){
91  iRecord.getRecord<SiPixelQualityFromDbRcd>().get(label, dbobject);
92  }
93  } //end getting the records from the parameters
94 
95  //now the dbobject is the one copied from the db
96  auto dbptr = std::make_unique<SiPixelQuality>(*(dbobject));
97 
98  //here is the magic line in which it switches off Bad Modules
99  dbptr->add(Voff.product());
100  return dbptr;
101 }
102 
103 
104 std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produce(const SiPixelQualityRcd & iRecord)
105 {
106  return get_pointer(iRecord, "");
107 }
108 std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produceWithLabel(const SiPixelQualityRcd & iRecord)
109 {
110  return get_pointer(iRecord, label);
111 }
112 
114  const edm::IOVSyncValue& iosv,
115  edm::ValidityInterval& oValidity ) {
117  oValidity = infinity;
118 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::unique_ptr< SiPixelQuality > produceWithLabel(const SiPixelQualityRcd &iRecord)
std::unique_ptr< SiPixelQuality > get_pointer(const SiPixelQualityRcd &iRecord, std::string label)
char const * label
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88
const double infinity
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
std::vector< edm::ParameterSet > Parameters
HLT enums.
std::unique_ptr< SiPixelQuality > produce(const SiPixelQualityRcd &iRecord)
T const * product() const
Definition: ESHandle.h:86
SiPixelQualityESProducer(const edm::ParameterSet &iConfig)