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 // $Id: SiStripQualityESProducer.cc,v 1.9 2010/02/09 08:39:33 demattia Exp $
17 //
18 //
19 
20 
21 
23 
24 
25 
27  pset_(iConfig),
28  toGet(iConfig.getParameter<Parameters>("ListOfRecordToMerge"))
29 {
30 
31  setWhatProduced(this);
32 
33  edm::LogInfo("SiStripQualityESProducer") << "ctor" << std::endl;
34 
35  quality.reset(new SiStripQuality());
36 }
37 
38 
39 boost::shared_ptr<SiStripQuality> SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord)
40 {
41 
42  edm::LogInfo("SiStripQualityESProducer") << "produce called" << std::endl;
43 
44  quality->clear();
45 
49  edm::ESHandle<RunInfo> runInfo;
50 
51  std::string tagName;
52  std::string recordName;
53 
54  bool doRunInfo = false;
55  std::string runInfoTagName = "";
56 
57  // Set the debug output level
58  quality->setPrintDebugOutput( pset_.getParameter<bool>("PrintDebugOutput") );
59  // Set the protection against empty RunInfo objects
60  quality->setUseEmptyRunInfo( pset_.getParameter<bool>("UseEmptyRunInfo") );
61 
62  for( Parameters::iterator itToGet = toGet.begin(); itToGet != toGet.end(); ++itToGet ) {
63  tagName = itToGet->getParameter<std::string>("tag");
64  recordName = itToGet->getParameter<std::string>("record");
65 
66  edm::LogInfo("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Getting data from record " << recordName << " with tag " << tagName << std::endl;
67 
68  if (recordName=="SiStripBadModuleRcd"){
69  iRecord.getRecord<SiStripBadModuleRcd>().get(tagName,obj);
70  quality->add( obj.product() );
71  } else if (recordName=="SiStripBadFiberRcd"){
72  iRecord.getRecord<SiStripBadFiberRcd>().get(tagName,obj);
73  quality->add( obj.product() );
74  } else if (recordName=="SiStripBadChannelRcd"){
75  iRecord.getRecord<SiStripBadChannelRcd>().get(tagName,obj);
76  quality->add( obj.product() );
77  } else if (recordName=="SiStripBadStripRcd"){
78  iRecord.getRecord<SiStripBadStripRcd>().get(tagName,obj);
79  quality->add( obj.product() );
80  } else if (recordName=="SiStripDetCablingRcd"){
81  iRecord.getRecord<SiStripDetCablingRcd>().get(tagName,cabling);
82  quality->add( cabling.product() );
83  } else if (recordName=="SiStripDetVOffRcd"){
84  iRecord.getRecord<SiStripDetVOffRcd>().get(tagName,Voff);
85  quality->add( Voff.product() );
86  } else if (recordName=="RunInfoRcd") {
87  runInfoTagName = tagName;
88  doRunInfo = true;
89  } else {
90  edm::LogError("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Skipping the requested data for unexisting record " << recordName << " with tag " << tagName << std::endl;
91  continue;
92  }
93  }
94  // We do this after all the others so we know it is done after the DetCabling (if any)
95  if( doRunInfo ) {
96  iRecord.getRecord<RunInfoRcd>().get(runInfoTagName,runInfo);
97  quality->add( runInfo.product() );
98  }
99 
100  quality->cleanUp();
101 
102  if(pset_.getParameter<bool>("ReduceGranularity")){
103  quality->ReduceGranularity(pset_.getParameter<double>("ThresholdForReducedGranularity"));
104  quality->cleanUp(true);
105  }
106 
107  quality->fillBadComponents();
108 
109  return quality;
110 }
111 
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:62
std::vector< edm::ParameterSet > Parameters
SiStripQualityESProducer(const edm::ParameterSet &)