CMS 3D CMS Logo

SiStripBadFiberBuilder.cc
Go to the documentation of this file.
2 
4 
5 #include <iostream>
6 #include <fstream>
7 #include <sstream>
8 
10 
11  fp_ = iConfig.getUntrackedParameter<edm::FileInPath>("file",edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"));
12  printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug",false);
13  BadComponentList_ = iConfig.getUntrackedParameter<Parameters>("BadComponentList");
14 }
15 
16 
18 }
19 
20 std::unique_ptr<SiStripBadStrip> SiStripBadFiberBuilder::getNewObject() {
21 
22  edm::LogInfo("SiStripBadFiberBuilder") << "... creating dummy SiStripBadStrip Data" << std::endl;
23 
24  auto obj = std::make_unique<SiStripBadStrip>();
25 
27 
28  std::stringstream ss;
29  for(Parameters::iterator iBadComponent = BadComponentList_.begin(); iBadComponent != BadComponentList_.end(); ++iBadComponent ) {
30 
31  uint32_t BadModule_ = iBadComponent->getParameter<uint32_t>("BadModule");
32  std::vector<uint32_t> BadApvList_ = iBadComponent->getParameter<std::vector<uint32_t> >("BadApvList");
33 
34  std::vector<unsigned int> theSiStripVector;
35 
36  unsigned short firstBadStrip=0, NconsecutiveBadStrips=0;
37  unsigned int theBadStripRange;
38 
39  for(std::vector<uint32_t>::const_iterator is=BadApvList_.begin(); is!=BadApvList_.end(); ++is){
40 
41  firstBadStrip=(*is)*128;
42  NconsecutiveBadStrips=128;
43 
44  theBadStripRange = obj->encode(firstBadStrip,NconsecutiveBadStrips);
45 
46  if (printdebug_)
47  ss << "detid " << BadModule_ << " \t"
48  << " firstBadStrip " << firstBadStrip << "\t "
49  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
50  << " packed integer " << std::hex << theBadStripRange << std::dec
51  << std::endl;
52 
53  theSiStripVector.push_back(theBadStripRange);
54  }
55 
56  SiStripBadStrip::Range range(theSiStripVector.begin(),theSiStripVector.end());
57  if ( ! obj->put(BadModule_,range) )
58  edm::LogError("SiStripBadFiberBuilder")<<"[SiStripBadFiberBuilder::analyze] detid already exists"<<std::endl;
59  }
60  if (printdebug_)
61  edm::LogInfo("SiStripBadFiberBuilder") << ss.str();
62 
63  return obj;
64 }
65 
66 
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< SiStripBadStrip > getNewObject() override
SiStripBadFiberBuilder(const edm::ParameterSet &)
std::vector< edm::ParameterSet > Parameters
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
Definition: FileInPath.cc:197