46 std::unordered_map<unsigned int, RPInfo>
m_rpInfo;
62 for (
const auto &entry_pset : conf.
getParameter<std::vector<edm::ParameterSet>>(
"configuration"))
66 std::vector<FileInfo> fileInfo;
67 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"opticalFunctions"))
69 const double &xangle =
pset.getParameter<
double>(
"xangle");
71 fileInfo.push_back({xangle, fileName});
74 std::unordered_map<unsigned int, RPInfo> rpInfo;
75 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"scoringPlanes"))
77 const unsigned int rpId =
pset.getParameter<
unsigned int>(
"rpId");
79 const double z =
pset.getParameter<
double>(
"z");
81 rpInfo.emplace(rpId, entry);
84 m_entries.push_back({validityRange, fileInfo, rpInfo});
88 findingRecord<CTPPSOpticsRcd>();
114 edm::LogInfo(
"") <<
"No configuration entry found for event " << iosv.
eventID() <<
", no optical functions will be available.";
123 std::unique_ptr<LHCOpticalFunctionsSetCollection>
127 auto output = std::make_unique<LHCOpticalFunctionsSetCollection>();
134 for (
const auto &fi :
entry.m_fileInfo)
136 std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
138 for (
const auto &rpi :
entry.m_rpInfo)
141 xa_data.emplace(rpi.first,
std::move(fcn));
144 output->emplace(fi.m_xangle, xa_data);
164 of_desc.
add<
double>(
"xangle")->setComment(
"half crossing angle value in urad");
165 of_desc.
add<
edm::FileInPath>(
"fileName")->setComment(
"ROOT file with optical functions");
166 std::vector<edm::ParameterSet> of;
167 config_desc.
addVPSet(
"opticalFunctions", of_desc, of)->
setComment(
"list of optical functions at different crossing angles");
170 sp_desc.
add<
unsigned int>(
"rpId")->setComment(
"associated detector DetId");
171 sp_desc.
add<
std::string>(
"dirName")->setComment(
"associated path to the optical functions file");
172 sp_desc.
add<
double>(
"z")->setComment(
"longitudinal position at scoring plane/detector");
173 std::vector<edm::ParameterSet> sp;
174 config_desc.
addVPSet(
"scoringPlanes", sp_desc, sp)->
setComment(
"list of sensitive planes/detectors stations");
176 std::vector<edm::ParameterSet>
config;
177 desc.
addVPSet(
"configuration", config_desc, sp)->
setComment(
"list of configuration blocks");
179 descriptions.
add(
"ctppsOpticalFunctionsESSource", desc);
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
EventNumber_t event() const
void setComment(std::string const &value)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
bool contains(EventRange const &lh, EventID const &rh)
Loads optical functions from ROOT files.
const EventID & eventID() const
std::vector< FileInfo > m_fileInfo
std::pair< Time_t, Time_t > ValidityInterval
LuminosityBlockNumber_t luminosityBlock() const
~CTPPSOpticalFunctionsESSource() override=default
unsigned int m_currentEntry
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
Set of optical functions corresponding to one scoring plane along LHC.
void fcn(int &, double *, double &, double *, int)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unordered_map< unsigned int, RPInfo > m_rpInfo
std::unique_ptr< LHCOpticalFunctionsSetCollection > produce(const CTPPSOpticsRcd &)
CTPPSOpticalFunctionsESSource(const edm::ParameterSet &)
std::vector< Entry > m_entries
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EventRange m_validityRange
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)