CMS 3D CMS Logo

SiStripQualityESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiStripQualityESProducer
4 // Class: SiStripQualityESProducer
5 //
13 //
14 // Original Author: Domenico GIORDANO
15 // Created: Wed Oct 3 12:11:10 CEST 2007
16 //
17 //
18 
19 
20 
22 
23 
24 
26  pset_(iConfig),
27  toGet(iConfig.getParameter<Parameters>("ListOfRecordToMerge"))
28 {
29 
30  setWhatProduced(this);
31 
32  edm::LogInfo("SiStripQualityESProducer") << "ctor" << std::endl;
33 
34 }
35 
36 
37 std::unique_ptr<SiStripQuality> SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord)
38 {
39  auto quality = std::make_unique<SiStripQuality>();
40  edm::LogInfo("SiStripQualityESProducer") << "produce called" << std::endl;
41 
42  quality->clear();
43 
47  edm::ESHandle<RunInfo> runInfo;
48 
51 
52  bool doRunInfo = false;
53  std::string runInfoTagName = "";
54 
55  // Set the debug output level
56  quality->setPrintDebugOutput( pset_.getParameter<bool>("PrintDebugOutput") );
57  // Set the protection against empty RunInfo objects
58  quality->setUseEmptyRunInfo( pset_.getParameter<bool>("UseEmptyRunInfo") );
59 
60  for( Parameters::iterator itToGet = toGet.begin(); itToGet != toGet.end(); ++itToGet ) {
61  tagName = itToGet->getParameter<std::string>("tag");
62  recordName = itToGet->getParameter<std::string>("record");
63 
64  edm::LogInfo("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Getting data from record " << recordName << " with tag " << tagName << std::endl;
65 
66  if (recordName=="SiStripBadModuleRcd"){
67  iRecord.getRecord<SiStripBadModuleRcd>().get(tagName,obj);
68  quality->add( obj.product() );
69  } else if (recordName=="SiStripBadModuleFedErrRcd"){
70  iRecord.getRecord<SiStripBadModuleFedErrRcd>().get(tagName,obj);
71  quality->add( obj.product() );
72  } else if (recordName=="SiStripBadFiberRcd"){
73  iRecord.getRecord<SiStripBadFiberRcd>().get(tagName,obj);
74  quality->add( obj.product() );
75  } else if (recordName=="SiStripBadChannelRcd"){
76  iRecord.getRecord<SiStripBadChannelRcd>().get(tagName,obj);
77  quality->add( obj.product() );
78  } else if (recordName=="SiStripBadStripRcd"){
79  iRecord.getRecord<SiStripBadStripRcd>().get(tagName,obj);
80  quality->add( obj.product() );
81  } else if (recordName=="SiStripDetCablingRcd"){
82  iRecord.getRecord<SiStripDetCablingRcd>().get(tagName,cabling);
83  quality->add( cabling.product() );
84  } else if (recordName=="SiStripDetVOffRcd"){
85  iRecord.getRecord<SiStripDetVOffRcd>().get(tagName,Voff);
86  quality->add( Voff.product() );
87  } else if (recordName=="RunInfoRcd") {
88  runInfoTagName = tagName;
89  doRunInfo = true;
90  } else {
91  edm::LogError("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Skipping the requested data for unexisting record " << recordName << " with tag " << tagName << std::endl;
92  continue;
93  }
94  }
95  // We do this after all the others so we know it is done after the DetCabling (if any)
96  if( doRunInfo ) {
97  iRecord.getRecord<RunInfoRcd>().get(runInfoTagName,runInfo);
98  quality->add( runInfo.product() );
99  }
100 
101  quality->cleanUp();
102 
103  if(pset_.getParameter<bool>("ReduceGranularity")){
104  quality->ReduceGranularity(pset_.getParameter<double>("ThresholdForReducedGranularity"));
105  quality->cleanUp(true);
106  }
107 
108  quality->fillBadComponents();
109 
110  return quality;
111 }
112 
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
std::unique_ptr< SiStripQuality > produce(const SiStripQualityRcd &)
T const * product() const
Definition: ESHandle.h:86
std::vector< edm::ParameterSet > Parameters
SiStripQualityESProducer(const edm::ParameterSet &)