CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CalibTracker/SiStripQuality/plugins/SiStripBadModuleByHandBuilder.cc

Go to the documentation of this file.
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>(iConfig){
00009 
00010   fp_ = iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
00011   BadModuleList_ = iConfig.getUntrackedParameter<std::vector<uint32_t> >("BadModuleList");
00012   printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug",false);
00013 
00014   reader = new SiStripDetInfoFileReader(fp_.fullPath());  
00015 }
00016 
00017 
00018 SiStripBadModuleByHandBuilder::~SiStripBadModuleByHandBuilder(){
00019 }
00020 
00021 SiStripBadStrip* SiStripBadModuleByHandBuilder::getNewObject(){
00022   
00023   SiStripBadStrip* obj = new SiStripBadStrip();
00024 
00025   unsigned int firstBadStrip=0;
00026   unsigned short NconsecutiveBadStrips;
00027   unsigned int theBadStripRange; 
00028 
00029   for(std::vector<uint32_t>::const_iterator it=BadModuleList_.begin(); it!=BadModuleList_.end(); ++it){
00030     
00031     std::vector<unsigned int> theSiStripVector;
00032     
00033     NconsecutiveBadStrips=reader->getNumberOfApvsAndStripLength(*it).first*128;
00034     theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips);
00035     if (printdebug_)
00036       edm::LogInfo("SiStripBadModuleByHandBuilder") << " BadModule " << *it << " \t"
00037                                                    << " firstBadStrip " << firstBadStrip << "\t "
00038                                                    << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
00039                                                    << " packed integer " << std::hex << theBadStripRange  << std::dec
00040                                                    << std::endl;            
00041     
00042     theSiStripVector.push_back(theBadStripRange);
00043     SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end());
00044     if ( ! obj->put(*it,range) )
00045       edm::LogError("SiStripBadModuleByHandBuilder")<<"[SiStripBadModuleByHandBuilder::analyze] detid already exists"<<std::endl;
00046   }
00047   return obj;
00048 }
00049 
00050