30 std::unique_ptr<SiStripBadStrip>
getNewObject()
override;
39 printdebug_(iConfig.getParameter<
bool>(
"printDebug")),
40 isFlagAvailable_(iConfig.getParameter<
bool>(
"isFlagAvailable")),
41 fp_(iConfig.getParameter<
edm::FileInPath>(
"file")) {}
46 desc.setComment(
"Conditions Builder for SiStripBadStrip Objects from input ASCII file");
48 desc.add<
bool>(
"printDebug",
false)->setComment(
"prints debug level messages");
49 desc.add<
bool>(
"isFlagAvailable",
true)->setComment(
"is the flag available in the input file");
54 auto SiStripBadStrip_ = std::make_unique<SiStripBadStrip>();
59 edm::LogError(
"SiStripBadStripFromASCIIFile") <<
"[SiStripBadStripFromASCIIFile::GetNewObject]" 60 <<
" Problem while trying to open File: " << (
fp_.
fullPath()).c_str();
69 short tempchannel = 0;
71 std::vector<unsigned int> theSiStripVector;
73 uint32_t tempdetid = 0;
81 infile >> detid >> channel;
85 unsigned int theBadStripRange = 0;
90 tempchannel = channel;
96 if (detid == tempdetid) {
97 if (channel != tempchannel +
count ||
flag != tempflag) {
99 theBadStripRange = SiStripBadStrip_->encode(
107 <<
"detid " << tempdetid <<
" \t" 108 <<
" firstBadStrip " << tempchannel <<
"\t " 109 <<
" NconsecutiveBadStrips " <<
count <<
"\t " 110 <<
"flag " << tempflag <<
"\t" 111 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec;
114 theSiStripVector.push_back(theBadStripRange);
118 if (!SiStripBadStrip_->put(tempdetid,
range))
120 <<
"[SiStripBadStripFromASCIIFile::GetNewObject] detid already exists";
121 theSiStripVector.clear();
125 tempchannel = channel;
133 if (detid != tempdetid) {
135 theBadStripRange = SiStripBadStrip_->encode(
141 edm::LogInfo(
"SiStripBadStripFromASCIIFile") <<
"detid " << tempdetid <<
" \t" 142 <<
" firstBadStrip " << tempchannel <<
"\t " 143 <<
" NconsecutiveBadStrips " <<
count <<
"\t " 144 <<
"flag " << tempflag <<
"\t" 145 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec;
148 theSiStripVector.push_back(theBadStripRange);
152 if (!SiStripBadStrip_->put(tempdetid,
range))
154 <<
"[SiStripBadStripFromASCIIFile::GetNewObject] detid already exists";
155 theSiStripVector.clear();
159 tempchannel = channel;
164 return SiStripBadStrip_;
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
SiStripBadStripFromASCIIFile(const edm::ParameterSet &iConfig)
std::string fullPath() const
Log< level::Error, false > LogError
~SiStripBadStripFromASCIIFile() override=default
const edm::FileInPath fp_
static void fillPSetDescription(edm::ParameterSetDescription &desc)
#define DEFINE_FWK_MODULE(type)
Log< level::Info, false > LogInfo
static void fillDescriptions(edm::ConfigurationDescriptions &)
std::pair< ContainerIterator, ContainerIterator > Range
const bool isFlagAvailable_
std::unique_ptr< SiStripBadStrip > getNewObject() override