11 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalIntercalibHandler")) {
12 edm::LogInfo(
"EcalIntercalib Source handler constructor\n");
22 std::ostringstream
ss;
25 unsigned long long irun;
31 if (m_file_type ==
"xml")
32 readXML(file_, *payload);
34 readTXT(file_, *payload);
45 if (!fxml.is_open()) {
50 for (
int i = 0;
i < 6;
i++) {
51 getline(fxml, dummyLine);
56 std::istringstream iEB(stt);
64 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
67 std::size_t
found = bid.find(
"</");
68 stt = bid.substr(6, found - 6);
69 float val = std::stof(stt);
70 record[myEBDetId] =
val;
72 for (
int i = 0;
i < 5;
i++) {
73 getline(fxml, dummyLine);
77 stt = bid.substr(7, 5);
78 std::istringstream iEE(stt);
87 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
90 std::size_t
found = bid.find(
"</");
91 stt = bid.substr(6, found - 6);
92 float val = std::stof(stt);
93 record[myEEDetId] =
val;
100 if (!ftxt.is_open()) {
104 int number_of_lines = 0,
eta, phi,
x, y, z;
107 while (std::getline(ftxt, line)) {
109 sscanf(line.c_str(),
"%i %i %i %f", &
eta, &phi, &z, &
val);
111 record[ebdetid] =
val;
113 sscanf(line.c_str(),
"%i %i %i %f", &x, &y, &z, &
val);
115 record[eedetid] =
val;
119 edm::LogInfo(
"Number of lines in text file: ") << number_of_lines;
121 if (number_of_lines != kChannels)
122 edm::LogInfo(
"wrong number of channels! Please check ");
void getNewObjects() override
static EEDetId unhashIndex(int hi)
void readTXT(const std::string &filename, EcalFloatCondObjectContainer &record)
void readXML(const std::string &filename, EcalFloatCondObjectContainer &record)
EcalIntercalibHandler(edm::ParameterSet const &)
static const int ETAPHIMODE
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
~EcalIntercalibHandler() override
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
EcalIntercalibConstantMap EcalIntercalibConstants