56 std::map<std::pair<int, int>, std::pair<float, float> >
lumiData_;
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,
','))
101 fields.push_back(field);
103 if (fields.size() != 9) {
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);
146 LogDebug(
"LumiProducerFromBrilcalc") <<
"Filling for run " << runls.first <<
" ls " << runls.second
147 <<
" with delivered " <<
lumiData_.at(runls).first <<
" dt " 149 iEvent.
put(std::make_unique<LumiInfo>(
lumiData_.at(runls).second, bxlumi,
lumiData_.at(runls).first),
"brilcalc");
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);
~LumiProducerFromBrilcalc()=default
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
#define DEFINE_FWK_MODULE(type)
edm::LuminosityBlockNumber_t luminosityBlock() const
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
LumiProducerFromBrilcalc(const edm::ParameterSet &)
std::map< std::pair< int, int >, std::pair< float, float > > lumiData_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const std::string lumiFile_
const bool throwIfNotFound_
const bool doBunchByBunch_