00001 // -*- C++ -*- 00002 // 00003 // Package: SiStripQualityESProducer 00004 // Class: SiStripQualityESProducer 00005 // 00013 // 00014 // Original Author: Domenico GIORDANO 00015 // Created: Wed Oct 3 12:11:10 CEST 2007 00016 // $Id: SiStripQualityESProducer.cc,v 1.9 2010/02/09 08:39:33 demattia Exp $ 00017 // 00018 // 00019 00020 00021 00022 #include "CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.h" 00023 00024 00025 00026 SiStripQualityESProducer::SiStripQualityESProducer(const edm::ParameterSet& iConfig): 00027 pset_(iConfig), 00028 toGet(iConfig.getParameter<Parameters>("ListOfRecordToMerge")) 00029 { 00030 00031 setWhatProduced(this); 00032 00033 edm::LogInfo("SiStripQualityESProducer") << "ctor" << std::endl; 00034 00035 quality.reset(new SiStripQuality()); 00036 } 00037 00038 00039 boost::shared_ptr<SiStripQuality> SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord) 00040 { 00041 00042 edm::LogInfo("SiStripQualityESProducer") << "produce called" << std::endl; 00043 00044 quality->clear(); 00045 00046 edm::ESHandle<SiStripBadStrip> obj; 00047 edm::ESHandle<SiStripDetCabling> cabling; 00048 edm::ESHandle<SiStripDetVOff> Voff; 00049 edm::ESHandle<RunInfo> runInfo; 00050 00051 std::string tagName; 00052 std::string recordName; 00053 00054 bool doRunInfo = false; 00055 std::string runInfoTagName = ""; 00056 00057 // Set the debug output level 00058 quality->setPrintDebugOutput( pset_.getParameter<bool>("PrintDebugOutput") ); 00059 // Set the protection against empty RunInfo objects 00060 quality->setUseEmptyRunInfo( pset_.getParameter<bool>("UseEmptyRunInfo") ); 00061 00062 for( Parameters::iterator itToGet = toGet.begin(); itToGet != toGet.end(); ++itToGet ) { 00063 tagName = itToGet->getParameter<std::string>("tag"); 00064 recordName = itToGet->getParameter<std::string>("record"); 00065 00066 edm::LogInfo("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Getting data from record " << recordName << " with tag " << tagName << std::endl; 00067 00068 if (recordName=="SiStripBadModuleRcd"){ 00069 iRecord.getRecord<SiStripBadModuleRcd>().get(tagName,obj); 00070 quality->add( obj.product() ); 00071 } else if (recordName=="SiStripBadFiberRcd"){ 00072 iRecord.getRecord<SiStripBadFiberRcd>().get(tagName,obj); 00073 quality->add( obj.product() ); 00074 } else if (recordName=="SiStripBadChannelRcd"){ 00075 iRecord.getRecord<SiStripBadChannelRcd>().get(tagName,obj); 00076 quality->add( obj.product() ); 00077 } else if (recordName=="SiStripBadStripRcd"){ 00078 iRecord.getRecord<SiStripBadStripRcd>().get(tagName,obj); 00079 quality->add( obj.product() ); 00080 } else if (recordName=="SiStripDetCablingRcd"){ 00081 iRecord.getRecord<SiStripDetCablingRcd>().get(tagName,cabling); 00082 quality->add( cabling.product() ); 00083 } else if (recordName=="SiStripDetVOffRcd"){ 00084 iRecord.getRecord<SiStripDetVOffRcd>().get(tagName,Voff); 00085 quality->add( Voff.product() ); 00086 } else if (recordName=="RunInfoRcd") { 00087 runInfoTagName = tagName; 00088 doRunInfo = true; 00089 } else { 00090 edm::LogError("SiStripQualityESProducer") << "[SiStripQualityESProducer::produce] Skipping the requested data for unexisting record " << recordName << " with tag " << tagName << std::endl; 00091 continue; 00092 } 00093 } 00094 // We do this after all the others so we know it is done after the DetCabling (if any) 00095 if( doRunInfo ) { 00096 iRecord.getRecord<RunInfoRcd>().get(runInfoTagName,runInfo); 00097 quality->add( runInfo.product() ); 00098 } 00099 00100 quality->cleanUp(); 00101 00102 if(pset_.getParameter<bool>("ReduceGranularity")){ 00103 quality->ReduceGranularity(pset_.getParameter<double>("ThresholdForReducedGranularity")); 00104 quality->cleanUp(true); 00105 } 00106 00107 quality->fillBadComponents(); 00108 00109 return quality; 00110 } 00111