44 std::unordered_map<unsigned int, RPInfo>
m_rpInfo;
58 for (
const auto &entry_pset : conf.
getParameter<std::vector<edm::ParameterSet>>(
"configuration")) {
61 std::vector<FileInfo> fileInfo;
62 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"opticalFunctions")) {
63 const double &xangle =
pset.getParameter<
double>(
"xangle");
65 fileInfo.push_back({xangle, fileName});
68 std::unordered_map<unsigned int, RPInfo> rpInfo;
69 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"scoringPlanes")) {
70 const unsigned int rpId =
pset.getParameter<
unsigned int>(
"rpId");
72 const double z =
pset.getParameter<
double>(
"z");
74 rpInfo.emplace(rpId, entry);
81 findingRecord<CTPPSOpticsRcd>();
107 <<
", no optical functions will be available.";
118 auto output = std::make_unique<LHCOpticalFunctionsSetCollection>();
124 for (
const auto &fi :
entry.m_fileInfo) {
125 std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
127 for (
const auto &rpi :
entry.m_rpInfo) {
129 xa_data.emplace(rpi.first,
std::move(fcn));
132 output->emplace(fi.m_xangle, xa_data);
150 of_desc.
add<
double>(
"xangle")->setComment(
"half crossing angle value in urad");
151 of_desc.
add<
edm::FileInPath>(
"fileName")->setComment(
"ROOT file with optical functions");
152 std::vector<edm::ParameterSet> of;
153 config_desc.
addVPSet(
"opticalFunctions", of_desc, of)
154 ->
setComment(
"list of optical functions at different crossing angles");
157 sp_desc.
add<
unsigned int>(
"rpId")->setComment(
"associated detector DetId");
158 sp_desc.
add<
std::string>(
"dirName")->setComment(
"associated path to the optical functions file");
159 sp_desc.
add<
double>(
"z")->setComment(
"longitudinal position at scoring plane/detector");
160 std::vector<edm::ParameterSet> sp;
161 config_desc.
addVPSet(
"scoringPlanes", sp_desc, sp)->
setComment(
"list of sensitive planes/detectors stations");
163 std::vector<edm::ParameterSet>
config;
164 desc.
addVPSet(
"configuration", config_desc, sp)->
setComment(
"list of configuration blocks");
166 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)