46 std::unordered_map<unsigned int, RPInfo>
m_rpInfo;
59 : m_label(conf.getParameter<
std::
string>(
"label")), m_currentEntryValid(
false), m_currentEntry(0) {
60 for (
const auto &entry_pset : conf.
getParameter<std::vector<edm::ParameterSet>>(
"configuration")) {
63 std::vector<FileInfo> fileInfo;
64 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"opticalFunctions")) {
65 const double &
xangle =
pset.getParameter<
double>(
"xangle");
70 std::unordered_map<unsigned int, RPInfo> rpInfo;
71 for (
const auto &
pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>(
"scoringPlanes")) {
72 const unsigned int rpId =
pset.getParameter<
unsigned int>(
"rpId");
74 const double z =
pset.getParameter<
double>(
"z");
76 rpInfo.emplace(rpId,
entry);
83 findingRecord<CTPPSOpticsRcd>();
109 <<
", no optical functions will be available.";
120 auto output = std::make_unique<LHCOpticalFunctionsSetCollection>();
126 for (
const auto &fi :
entry.m_fileInfo) {
127 std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
129 for (
const auto &rpi :
entry.m_rpInfo) {
134 output->emplace(fi.m_xangle, xa_data);
147 desc.add<
std::string>(
"label",
"")->setComment(
"label of the optics record");
154 of_desc.
add<
double>(
"xangle")->setComment(
"half crossing angle value in urad");
155 of_desc.
add<
edm::FileInPath>(
"fileName")->setComment(
"ROOT file with optical functions");
156 std::vector<edm::ParameterSet>
of;
157 config_desc.
addVPSet(
"opticalFunctions", of_desc,
of)
158 ->
setComment(
"list of optical functions at different crossing angles");
161 sp_desc.
add<
unsigned int>(
"rpId")->setComment(
"associated detector DetId");
162 sp_desc.
add<
std::string>(
"dirName")->setComment(
"associated path to the optical functions file");
163 sp_desc.
add<
double>(
"z")->setComment(
"longitudinal position at scoring plane/detector");
164 std::vector<edm::ParameterSet> sp;
165 config_desc.
addVPSet(
"scoringPlanes", sp_desc, sp)->
setComment(
"list of sensitive planes/detectors stations");
167 std::vector<edm::ParameterSet>
config;
168 desc.addVPSet(
"configuration", config_desc, sp)->setComment(
"list of configuration blocks");
170 descriptions.
add(
"ctppsOpticalFunctionsESSource",
desc);
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
void setComment(std::string const &value)
T getParameter(std::string const &) const
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.
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
Log< level::Info, false > LogInfo
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Set of optical functions corresponding to one scoring plane along LHC.
void fcn(int &, double *, double &, double *, int)
config
parse the configuration file
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const EventID & eventID() const
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
EventNumber_t event() const