00001 #include "CalibTracker/SiStripQuality/plugins/SiStripBadModuleByHandBuilder.h" 00002 00003 00004 #include <iostream> 00005 #include <fstream> 00006 00007 00008 SiStripBadModuleByHandBuilder::SiStripBadModuleByHandBuilder(const edm::ParameterSet& iConfig) : ConditionDBWriter<SiStripBadStrip>::ConditionDBWriter<SiStripBadStrip>(iConfig){ 00009 00010 edm::LogInfo("SiStripBadModuleByHandBuilder") << " ctor "; 00011 fp_ = iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")); 00012 BadModuleList_ = iConfig.getUntrackedParameter<std::vector<uint32_t> >("BadModuleList"); 00013 printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug",false); 00014 00015 reader = new SiStripDetInfoFileReader(fp_.fullPath()); 00016 } 00017 00018 00019 SiStripBadModuleByHandBuilder::~SiStripBadModuleByHandBuilder(){ 00020 edm::LogInfo("SiStripBadModuleByHandBuilder") << " dtor"; 00021 } 00022 00023 SiStripBadStrip* SiStripBadModuleByHandBuilder::getNewObject(){ 00024 00025 edm::LogInfo("SiStripBadModuleByHandBuilder") <<"SiStripBadModuleByHandBuilder::getNewObject called"<<std::endl; 00026 00027 SiStripBadStrip* obj = new SiStripBadStrip(); 00028 00029 unsigned int firstBadStrip=0; 00030 unsigned short NconsecutiveBadStrips; 00031 unsigned int theBadStripRange; 00032 00033 for(std::vector<uint32_t>::const_iterator it=BadModuleList_.begin(); it!=BadModuleList_.end(); ++it){ 00034 00035 std::vector<unsigned int> theSiStripVector; 00036 00037 NconsecutiveBadStrips=reader->getNumberOfApvsAndStripLength(*it).first*128; 00038 theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips); 00039 if (printdebug_) 00040 edm::LogInfo("SiStripBadModuleByHandBuilder") << " BadModule " << *it << " \t" 00041 << " firstBadStrip " << firstBadStrip << "\t " 00042 << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t " 00043 << " packed integer " << std::hex << theBadStripRange << std::dec 00044 << std::endl; 00045 00046 theSiStripVector.push_back(theBadStripRange); 00047 SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end()); 00048 if ( ! obj->put(*it,range) ) 00049 edm::LogError("SiStripBadModuleByHandBuilder")<<"[SiStripBadModuleByHandBuilder::analyze] detid already exists"<<std::endl; 00050 } 00051 return obj; 00052 } 00053 00054