48 std::unordered_map<unsigned int, RPInfo>
m_rpInfo;
65 for (
const auto &entry_pset : conf.
getParameter<std::vector<edm::ParameterSet>>(
"configuration"))
69 std::vector<FileInfo> fileInfo;
70 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"opticalFunctions"))
72 const double &
xangle =
pset.getParameter<
double>(
"xangle");
74 fileInfo.push_back({
xangle, fileName});
77 std::unordered_map<unsigned int, RPInfo> rpInfo;
78 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"scoringPlanes"))
80 const unsigned int rpId =
pset.getParameter<
unsigned int>(
"rpId");
82 const double z =
pset.getParameter<
double>(
"z");
84 rpInfo.emplace(rpId, entry);
91 findingRecord<CTPPSOpticsRcd>();
117 edm::LogInfo(
"") <<
"No configuration entry found for event " << iosv.
eventID() <<
", no optical functions will be available.";
126 std::unique_ptr<LHCOpticalFunctionsSetCollection>
130 auto output = std::make_unique<LHCOpticalFunctionsSetCollection>();
137 for (
const auto &fi :
entry.m_fileInfo)
139 std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
141 for (
const auto &rpi :
entry.m_rpInfo)
144 xa_data.emplace(rpi.first,
std::move(fcn));
147 output->emplace(fi.m_xangle, xa_data);
162 desc.
add<
std::string>(
"label",
"")->setComment(
"label of the optics record");
169 of_desc.
add<
double>(
"xangle")->setComment(
"half crossing angle value in urad");
170 of_desc.
add<
edm::FileInPath>(
"fileName")->setComment(
"ROOT file with optical functions");
171 std::vector<edm::ParameterSet> of;
172 config_desc.
addVPSet(
"opticalFunctions", of_desc, of)->
setComment(
"list of optical functions at different crossing angles");
175 sp_desc.
add<
unsigned int>(
"rpId")->setComment(
"associated detector DetId");
176 sp_desc.
add<
std::string>(
"dirName")->setComment(
"associated path to the optical functions file");
177 sp_desc.
add<
double>(
"z")->setComment(
"longitudinal position at scoring plane/detector");
178 std::vector<edm::ParameterSet> sp;
179 config_desc.
addVPSet(
"scoringPlanes", sp_desc, sp)->
setComment(
"list of sensitive planes/detectors stations");
181 std::vector<edm::ParameterSet>
config;
182 desc.
addVPSet(
"configuration", config_desc, sp)->
setComment(
"list of configuration blocks");
184 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)