21 edm::LogInfo(
"SiStripGainFromAsciiFile::~SiStripGainFromAsciiFile");
25 auto obj = std::make_unique<SiStripApvGain>();
29 ss <<
"[SiStripGainFromAsciiFile::getNewObject]\n Reading Ascii File\n";
43 char* pch = strtok_r(
line,
" ", &saveptr);
45 while (pch !=
nullptr) {
47 sscanf(pch,
"%d", &
detid);
48 }
else if (Arg <= 6) {
49 sscanf(pch,
"%f", &(MG.
apv[Arg - 1]));
53 pch = strtok_r(
nullptr,
" ", &saveptr);
56 ss <<
detid <<
" " << MG.
apv[0] <<
" " << MG.
apv[1] <<
" " << MG.
apv[2] <<
" " << MG.
apv[3] <<
" " << MG.
apv[4]
57 <<
" " << MG.
apv[5] << std::endl;
58 GainsMap.insert(std::pair<unsigned int, ModuleGain>(
detid, MG));
64 <<
" [SiStripGainFromAsciiFile::getNewObject] Error opening file " <<
Asciifilename_ << std::endl;
71 ss <<
"[SiStripGainFromAsciiFile::getNewObject]\n Filling SiStripApvGain object";
73 for (
const auto it : detInfo.getAllDetIds()) {
78 nApvPair = detInfo.getNumberOfApvsAndStripLength(
it).first / 2;
80 ss <<
"Looking at detid " <<
it <<
" nApvPairs " << nApvPair << std::endl;
84 ss <<
" " << MG.
apv[0] <<
" " << MG.
apv[1] <<
" " << MG.
apv[2] <<
" " << MG.
apv[3] <<
" " << MG.
apv[4] <<
" " 85 << MG.
apv[5] << std::endl;
87 ss <<
"Hard reset for detid " <<
it << std::endl;
91 std::vector<float> DetGainsVector;
98 }
else if (nApvPair == 3) {
106 edm::LogError(
"SiStripGainFromAsciiFile") <<
" SiStripGainFromAsciiFile::getNewObject] ERROR for detid " <<
it 107 <<
" not expected number of APV pairs " << nApvPair << std::endl;
113 <<
" [SiStripGainFromAsciiFile::getNewObject] detid already exists" << std::endl;
114 ss <<
" [SiStripGainFromAsciiFile::getNewObject] detid already exists" << std::endl;
T getParameter(std::string const &) const
SiStripGainFromAsciiFile(const edm::ParameterSet &)
void hard_reset(float val)
std::string Asciifilename_
Log< level::Error, false > LogError
constexpr Detector det() const
get the detector field from this detid
~SiStripGainFromAsciiFile() override
T getUntrackedParameter(std::string const &, T const &) const
std::pair< ContainerIterator, ContainerIterator > Range
std::unique_ptr< SiStripApvGain > getNewObject() override
SiStripDetInfo read(std::string filePath)
std::unordered_map< unsigned int, ModuleGain > GainsMap
Log< level::Info, false > LogInfo
static constexpr char const *const kDefaultFile
const std::string & fullPath() const