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