56 std::map<std::pair<int, int>, std::pair<float, float> >
lumiData_;
64 : lumiFile_(iConfig.getParameter<
std::
string>(
"lumiFile")),
65 throwIfNotFound_(iConfig.getParameter<
bool>(
"throwIfNotFound")),
66 doBunchByBunch_(iConfig.getParameter<
bool>(
"doBunchByBunch")) {
68 produces<LumiInfo>(
"brilcalc");
73 <<
"Sorry, bunch-by-bunch luminosity is not yet supported. Please bug your friendly lumi expert!";
77 edm::LogInfo(
"LumiProducerFromBrilcalc") <<
"Reading luminosity data from " <<
lumiFile_ <<
"...one moment...";
79 if (!lumiFile.is_open()) {
86 std::getline(lumiFile,
line);
87 if (lumiFile.eof() || lumiFile.fail())
91 if (
line.at(0) ==
'#')
96 std::stringstream
ss(
line);
98 std::vector<std::string>
fields;
100 while (std::getline(
ss, field,
','))
111 std::stringstream runfill(
fields[0]);
113 std::stringstream lsls(
fields[1]);
117 float lumiDel, lumiRec, dtFrac;
118 std::stringstream lumiDelString(
fields[5]);
119 lumiDelString >> lumiDel;
120 std::stringstream lumiRecString(
fields[6]);
121 lumiRecString >> lumiRec;
124 dtFrac = 1.0 - lumiRec / lumiDel;
127 lumiData_[std::make_pair(
run,
ls)] = std::make_pair(lumiDel, dtFrac);
142 std::vector<float> bxlumi(3564, 0);
143 std::pair<int, int> runls = std::make_pair(
iEvent.run(),
iEvent.luminosityBlock());
146 LogDebug(
"LumiProducerFromBrilcalc") <<
"Filling for run " << runls.first <<
" ls " << runls.second
147 <<
" with delivered " <<
lumiData_.at(runls).first <<
" dt "
153 <<
"Failed to find luminosity for run " << runls.first <<
" LS " << runls.second;
157 <<
"Failed to find luminosity for run " << runls.first <<
" ls " << runls.second;
158 iEvent.put(std::make_unique<LumiInfo>(0, bxlumi, 0),
"brilcalc");
168 desc.
add<
bool>(
"throwIfNotFound",
false);
169 desc.
add<
bool>(
"doBunchByBunch",
false);