26 auto obj = std::make_unique<SiStripApvGain>();
30 ss <<
"[SiStripGainFromAsciiFile::getNewObject]\n Reading Ascii File\n";
34 while (fgets(line, 4096, infile) !=
nullptr) {
44 char* pch = strtok_r(line,
" ", &saveptr);
46 while (pch !=
nullptr) {
48 sscanf(pch,
"%d", &detid);
49 }
else if (Arg <= 6) {
50 sscanf(pch,
"%f", &(MG.apv[Arg - 1]));
54 pch = strtok_r(
nullptr,
" ", &saveptr);
57 ss << detid <<
" " << MG.apv[0] <<
" " << MG.apv[1] <<
" " << MG.apv[2] <<
" " << MG.apv[3] <<
" " << MG.apv[4]
58 <<
" " << MG.apv[5] << std::endl;
59 GainsMap.insert(std::pair<unsigned int, ModuleGain>(detid, MG));
65 <<
" [SiStripGainFromAsciiFile::getNewObject] Error opening file " <<
Asciifilename_ << std::endl;
71 const std::vector<uint32_t>& DetIds =
reader.getAllDetIds();
74 ss <<
"[SiStripGainFromAsciiFile::getNewObject]\n Filling SiStripApvGain object";
76 for (std::vector<uint32_t>::const_iterator it = DetIds.begin(); it != DetIds.end(); it++) {
81 nApvPair =
reader.getNumberOfApvsAndStripLength(*it).first / 2;
83 ss <<
"Looking at detid " << *it <<
" nApvPairs " << nApvPair << std::endl;
87 ss <<
" " << MG.apv[0] <<
" " << MG.apv[1] <<
" " << MG.apv[2] <<
" " << MG.apv[3] <<
" " << MG.apv[4] <<
" " 88 << MG.apv[5] << std::endl;
90 ss <<
"Hard reset for detid " << *it << std::endl;
94 std::vector<float> DetGainsVector;
101 }
else if (nApvPair == 3) {
109 edm::LogError(
"SiStripGainFromAsciiFile") <<
" SiStripGainFromAsciiFile::getNewObject] ERROR for detid " << *it
110 <<
" not expected number of APV pairs " << nApvPair << std::endl;
116 <<
" [SiStripGainFromAsciiFile::getNewObject] detid already exists" << std::endl;
117 ss <<
" [SiStripGainFromAsciiFile::getNewObject] detid already exists" << std::endl;
std::string Asciifilename_
std::pair< ContainerIterator, ContainerIterator > Range
std::unordered_map< unsigned int, ModuleGain > GainsMap
std::string fullPath() const
constexpr Detector det() const
get the detector field from this detid