CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  quality.reset(new SiStripQuality());
35 }
36 
37 
38 boost::shared_ptr<SiStripQuality> SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord)
39 {
40 
41  edm::LogInfo("SiStripQualityESProducer") << "produce called" << std::endl;
42 
43  quality->clear();
44 
48  edm::ESHandle<RunInfo> runInfo;
49 
50  std::string tagName;
52 
53  bool doRunInfo = false;
54  std::string runInfoTagName = "";
55 
56  // Set the debug output level
57  quality->setPrintDebugOutput( pset_.getParameter<bool>("PrintDebugOutput") );
58  // Set the protection against empty RunInfo objects
59  quality->setUseEmptyRunInfo( pset_.getParameter<bool>("UseEmptyRunInfo") );
60 
61  for( Parameters::iterator itToGet = toGet.begin(); itToGet != toGet.end(); ++itToGet ) {
62  tagName = itToGet->getParameter<std::string>("tag");
63  recordName = itToGet->getParameter<std::string>("record");
64 
65  edm::LogInfo("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Getting data from record " << recordName << " with tag " << tagName << std::endl;
66 
67  if (recordName=="SiStripBadModuleRcd"){
68  iRecord.getRecord<SiStripBadModuleRcd>().get(tagName,obj);
69  quality->add( obj.product() );
70  } else if (recordName=="SiStripBadFiberRcd"){
71  iRecord.getRecord<SiStripBadFiberRcd>().get(tagName,obj);
72  quality->add( obj.product() );
73  } else if (recordName=="SiStripBadChannelRcd"){
74  iRecord.getRecord<SiStripBadChannelRcd>().get(tagName,obj);
75  quality->add( obj.product() );
76  } else if (recordName=="SiStripBadStripRcd"){
77  iRecord.getRecord<SiStripBadStripRcd>().get(tagName,obj);
78  quality->add( obj.product() );
79  } else if (recordName=="SiStripDetCablingRcd"){
80  iRecord.getRecord<SiStripDetCablingRcd>().get(tagName,cabling);
81  quality->add( cabling.product() );
82  } else if (recordName=="SiStripDetVOffRcd"){
83  iRecord.getRecord<SiStripDetVOffRcd>().get(tagName,Voff);
84  quality->add( Voff.product() );
85  } else if (recordName=="RunInfoRcd") {
86  runInfoTagName = tagName;
87  doRunInfo = true;
88  } else {
89  edm::LogError("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Skipping the requested data for unexisting record " << recordName << " with tag " << tagName << std::endl;
90  continue;
91  }
92  }
93  // We do this after all the others so we know it is done after the DetCabling (if any)
94  if( doRunInfo ) {
95  iRecord.getRecord<RunInfoRcd>().get(runInfoTagName,runInfo);
96  quality->add( runInfo.product() );
97  }
98 
99  quality->cleanUp();
100 
101  if(pset_.getParameter<bool>("ReduceGranularity")){
102  quality->ReduceGranularity(pset_.getParameter<double>("ThresholdForReducedGranularity"));
103  quality->cleanUp(true);
104  }
105 
106  quality->fillBadComponents();
107 
108  return quality;
109 }
110 
T getParameter(std::string const &) const
boost::shared_ptr< SiStripQuality > produce(const SiStripQualityRcd &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
boost::shared_ptr< SiStripQuality > quality
T const * product() const
Definition: ESHandle.h:86
std::vector< edm::ParameterSet > Parameters
SiStripQualityESProducer(const edm::ParameterSet &)