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  toGet(conf_.getParameter<Parameters>("ListOfRecordToMerge"))
41 {
42  edm::LogInfo("SiPixelQualityESProducer::SiPixelQualityESProducer");
43  //the following line is needed to tell the framework what
44  // data is being produced
45  setWhatProduced(this);
46  findingRecord<SiPixelQualityRcd>();
47 }
48 
49 
51 {
52 
53  // do anything here that needs to be done at desctruction time
54  // (e.g. close files, deallocate resources etc.)
55 
56 }
57 
58 std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produce(const SiPixelQualityRcd & iRecord)
59 {
60 
62 
64  // errortype "whole" = int 0 in DB BadRocs = 65535 //
65  // errortype "tbmA" = int 1 in DB BadRocs = 255 //
66  // errortype "tbmB" = int 2 in DB Bad Rocs = 65280 //
67  // errortype "none" = int 3 in DB //
69 
70  //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)
71  //SiPixelQuality * obj = new SiPixelQuality();
72  //SiPixelQuality::disabledModuleType BadModule;
73  //BadModule.DetID = 1; BadModule.errorType = 0; BadModule.BadRocs = 65535; obj->addDisabledModule(BadModule);
74 
75  //start with the record thta existed already to decouple the debugging
76  //here i can do whatever i need with the detVoff
77 
80 
81  for( Parameters::iterator itToGet = toGet.begin(); itToGet != toGet.end(); ++itToGet ) {
82 
83  recordName = itToGet->getParameter<std::string>("record");
84 
85  if (recordName=="SiPixelDetVOffRcd")
86  iRecord.getRecord<SiPixelDetVOffRcd>().get(Voff);
87  if (recordName=="SiPixelQualityFromDbRcd")
88  iRecord.getRecord<SiPixelQualityFromDbRcd>().get(dbobject);
89  } //end getting the records from the parameters
90 
91  //now the dbobject is the one copied from the db
92  //here make a copy of dbobject, but now the label has to be empty not to interfeare with the Reco
93  auto dbptr = std::make_unique<SiPixelQuality>(*(dbobject));
94 
95  //here is the magic line in which it switches off Bad Modules
96  dbptr->add(Voff.product());
97 
98  return dbptr;
99 }
100 
102  const edm::IOVSyncValue& iosv,
103  edm::ValidityInterval& oValidity ) {
105  oValidity = infinity;
106 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:116
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static const IOVSyncValue & beginOfTime()
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:84
SiPixelQualityESProducer(const edm::ParameterSet &iConfig)