#include <CondTools/SiStrip/plugins/SiStripBadChannelBuilder.h>
Public Member Functions | |
void | algoAnalyze (const edm::Event &event, const edm::EventSetup &iSetup) |
SiStripBadChannelBuilder (const edm::ParameterSet &) | |
~SiStripBadChannelBuilder () | |
Private Types | |
typedef std::vector < edm::ParameterSet > | Parameters |
Private Member Functions | |
SiStripBadStrip * | getNewObject () |
Private Attributes | |
Parameters | BadComponentList_ |
edm::FileInPath | fp_ |
SiStripBadStrip * | obj |
bool | printdebug_ |
Definition at line 19 of file SiStripBadChannelBuilder.h.
typedef std::vector< edm::ParameterSet > SiStripBadChannelBuilder::Parameters [private] |
Definition at line 37 of file SiStripBadChannelBuilder.h.
SiStripBadChannelBuilder::SiStripBadChannelBuilder | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 8 of file SiStripBadChannelBuilder.cc.
References BadComponentList_, fp_, edm::ParameterSet::getUntrackedParameter(), and printdebug_.
00008 : ConditionDBWriter<SiStripBadStrip>::ConditionDBWriter<SiStripBadStrip>(iConfig){ 00009 00010 edm::LogInfo("SiStripBadChannelBuilder") << " ctor "; 00011 fp_ = iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")); 00012 printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug",false); 00013 BadComponentList_ = iConfig.getUntrackedParameter<Parameters>("BadComponentList"); 00014 }
SiStripBadChannelBuilder::~SiStripBadChannelBuilder | ( | ) |
Definition at line 17 of file SiStripBadChannelBuilder.cc.
00017 { 00018 edm::LogInfo("SiStripBadChannelBuilder") << " dtor"; 00019 }
void SiStripBadChannelBuilder::algoAnalyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Reimplemented from ConditionDBWriter< SiStripBadStrip >.
Definition at line 21 of file SiStripBadChannelBuilder.cc.
References BadComponentList_, SiStripBadStrip::encode(), lat::endl(), fp_, edm::FileInPath::fullPath(), edm::Service< T >::isAvailable(), obj, printdebug_, SiStripBadStrip::put(), range, and mergeAndRegister_online::run.
00021 { 00022 00023 edm::LogInfo("SiStripBadChannelBuilder") <<"SiStripBadChannelBuilder::algoAnalyze called"<<std::endl; 00024 unsigned int run=event.id().run(); 00025 00026 edm::LogInfo("SiStripBadChannelBuilder") << "... creating dummy SiStripBadStrip Data for Run " << run << "\n " << std::endl; 00027 00028 SiStripBadStrip* obj = new SiStripBadStrip(); 00029 00030 SiStripDetInfoFileReader reader(fp_.fullPath()); 00031 00032 const std::vector<uint32_t> DetIds = reader.getAllDetIds(); 00033 00034 for(Parameters::iterator iBadComponent = BadComponentList_.begin(); iBadComponent != BadComponentList_.end(); ++iBadComponent ) { 00035 00036 uint32_t BadModule_ = iBadComponent->getParameter<uint32_t>("BadModule"); 00037 std::vector<uint32_t> BadChannelList_ = iBadComponent->getParameter<std::vector<uint32_t> >("BadChannelList"); 00038 00039 std::vector<unsigned int> theSiStripVector; 00040 unsigned int NStrips=reader.getNumberOfApvsAndStripLength(BadModule_).first*128; 00041 00042 unsigned short lastBad=999; 00043 unsigned short firstBadStrip=0, NconsecutiveBadStrips=0; 00044 unsigned int theBadStripRange; 00045 00046 for(std::vector<uint32_t>::const_iterator is=BadChannelList_.begin(); is!=BadChannelList_.end(); ++is){ 00047 if (*is>NStrips-1) 00048 break; 00049 if (*is!=lastBad+1){ 00050 //new set 00051 00052 if ( lastBad!=999 ){ 00053 //save previous set 00054 theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips); 00055 00056 if (printdebug_) 00057 edm::LogInfo("SiStripBadChannelBuilder") << "detid " << BadModule_ << " \t" 00058 << " firstBadStrip " << firstBadStrip << "\t " 00059 << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t " 00060 << " packed integer " << std::hex << theBadStripRange << std::dec 00061 << std::endl; 00062 00063 theSiStripVector.push_back(theBadStripRange); 00064 } 00065 00066 firstBadStrip=*is; 00067 NconsecutiveBadStrips=0; 00068 } 00069 NconsecutiveBadStrips++; 00070 lastBad=*is; 00071 } 00072 00073 theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips); 00074 if (printdebug_) 00075 edm::LogInfo("SiStripBadChannelBuilder") << "detid " << BadModule_ << " \t" 00076 << " firstBadStrip " << firstBadStrip << "\t " 00077 << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t " 00078 << " packed integer " << std::hex << theBadStripRange << std::dec 00079 << std::endl; 00080 00081 theSiStripVector.push_back(theBadStripRange); 00082 00083 SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end()); 00084 if ( ! obj->put(BadModule_,range) ) 00085 edm::LogError("SiStripBadChannelBuilder")<<"[SiStripBadChannelBuilder::analyze] detid already exists"<<std::endl; 00086 } 00087 //End now write sistripbadChannel data in DB 00088 edm::Service<cond::service::PoolDBOutputService> mydbservice; 00089 00090 if( mydbservice.isAvailable() ){ 00091 if ( mydbservice->isNewTagRequest("SiStripBadStripRcd") ){ 00092 mydbservice->createNewIOV<SiStripBadStrip>(obj,mydbservice->beginOfTime(),mydbservice->endOfTime(),"SiStripBadStripRcd"); 00093 } else { 00094 //mydbservice->createNewIOV<SiStripBadStrip>(obj,mydbservice->currentTime(),"SiStripBadStripRcd"); 00095 mydbservice->appendSinceTime<SiStripBadStrip>(obj,mydbservice->currentTime(),"SiStripBadStripRcd"); 00096 } 00097 }else{ 00098 edm::LogError("SiStripBadStripBuilder")<<"Service is unavailable"<<std::endl; 00099 } 00100 00101 }
SiStripBadStrip* SiStripBadChannelBuilder::getNewObject | ( | ) | [inline, private, virtual] |
Implements ConditionDBWriter< SiStripBadStrip >.
Definition at line 30 of file SiStripBadChannelBuilder.h.
References obj.
00030 {return obj;}
Definition at line 38 of file SiStripBadChannelBuilder.h.
Referenced by algoAnalyze(), and SiStripBadChannelBuilder().
edm::FileInPath SiStripBadChannelBuilder::fp_ [private] |
Definition at line 33 of file SiStripBadChannelBuilder.h.
Referenced by algoAnalyze(), and SiStripBadChannelBuilder().
SiStripBadStrip* SiStripBadChannelBuilder::obj [private] |
Definition at line 35 of file SiStripBadChannelBuilder.h.
Referenced by algoAnalyze(), and getNewObject().
bool SiStripBadChannelBuilder::printdebug_ [private] |
Definition at line 34 of file SiStripBadChannelBuilder.h.
Referenced by algoAnalyze(), and SiStripBadChannelBuilder().