CMS 3D CMS Logo

SiStripBadModuleByHandBuilder.cc
Go to the documentation of this file.
5 
9 
10 #include <vector>
11 #include <iostream>
12 #include <fstream>
13 #include <ext/hash_map>
14 
15 class SiStripBadModuleByHandBuilder : public ConditionDBWriter<SiStripBadStrip> {
16 public:
18  ~SiStripBadModuleByHandBuilder() override = default;
19 
20 private:
21  std::unique_ptr<SiStripBadStrip> getNewObject() override;
22 
23 private:
26  std::vector<uint32_t> BadModuleList_;
27 };
28 
32  BadModuleList_ = iConfig.getUntrackedParameter<std::vector<uint32_t> >("BadModuleList");
33  printdebug_ = iConfig.getUntrackedParameter<bool>("printDebug", false);
34 }
35 
36 std::unique_ptr<SiStripBadStrip> SiStripBadModuleByHandBuilder::getNewObject() {
37  const auto detInfo = SiStripDetInfoFileReader::read(fp_.fullPath());
38 
39  auto obj = std::make_unique<SiStripBadStrip>();
40 
41  unsigned int firstBadStrip = 0;
42  unsigned short NconsecutiveBadStrips;
43  unsigned int theBadStripRange;
44 
45  for (std::vector<uint32_t>::const_iterator it = BadModuleList_.begin(); it != BadModuleList_.end(); ++it) {
46  std::vector<unsigned int> theSiStripVector;
47 
48  NconsecutiveBadStrips = detInfo.getNumberOfApvsAndStripLength(*it).first * 128;
49  theBadStripRange = obj->encode(firstBadStrip, NconsecutiveBadStrips);
50  if (printdebug_)
51  edm::LogInfo("SiStripBadModuleByHandBuilder")
52  << " BadModule " << *it << " \t"
53  << " firstBadStrip " << firstBadStrip << "\t "
54  << " NconsecutiveBadStrips " << NconsecutiveBadStrips << "\t "
55  << " packed integer " << std::hex << theBadStripRange << std::dec << std::endl;
56 
57  theSiStripVector.push_back(theBadStripRange);
58  SiStripBadStrip::Range range(theSiStripVector.begin(), theSiStripVector.end());
59  if (!obj->put(*it, range))
60  edm::LogError("SiStripBadModuleByHandBuilder")
61  << "[SiStripBadModuleByHandBuilder::analyze] detid already exists" << std::endl;
62  }
63  return obj;
64 }
65 
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MessageLogger.h
SiStripBadModuleByHandBuilder::printdebug_
bool printdebug_
Definition: SiStripBadModuleByHandBuilder.cc:25
SiStripBadModuleByHandBuilder::~SiStripBadModuleByHandBuilder
~SiStripBadModuleByHandBuilder() override=default
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripBadStrip.h
SiStripDetInfoFileReader::read
SiStripDetInfo read(std::string filePath)
Definition: SiStripDetInfoFileReader.cc:11
SiStripBadStrip
Definition: SiStripBadStrip.h:30
edm::FileInPath
Definition: FileInPath.h:61
MakerMacros.h
SiStripBadStrip::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripBadStrip.h:53
ConditionDBWriter
Definition: ConditionDBWriter.h:149
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiStripDetInfoFileReader.h
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
FileInPath.h
SiStripBadModuleByHandBuilder::getNewObject
std::unique_ptr< SiStripBadStrip > getNewObject() override
Definition: SiStripBadModuleByHandBuilder.cc:36
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripBadModuleByHandBuilder::BadModuleList_
std::vector< uint32_t > BadModuleList_
Definition: SiStripBadModuleByHandBuilder.cc:26
ConditionDBWriter.h
SiStripBadModuleByHandBuilder::fp_
edm::FileInPath fp_
Definition: SiStripBadModuleByHandBuilder.cc:24
SiStripDetInfoFileReader::kDefaultFile
constexpr static char const *const kDefaultFile
Definition: SiStripDetInfoFileReader.h:10
SiStripBadModuleByHandBuilder
Definition: SiStripBadModuleByHandBuilder.cc:15
Exception.h
ParameterSet.h
SiStripBadModuleByHandBuilder::SiStripBadModuleByHandBuilder
SiStripBadModuleByHandBuilder(const edm::ParameterSet &)
Definition: SiStripBadModuleByHandBuilder.cc:29
edm::Log
Definition: MessageLogger.h:70
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161