CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CTPPSOpticalFunctionsESSource Class Reference

Loads optical functions from ROOT files. More...

Inheritance diagram for CTPPSOpticalFunctionsESSource:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Classes

struct  Entry
 
struct  FileInfo
 
struct  RPInfo
 

Public Member Functions

 CTPPSOpticalFunctionsESSource (const edm::ParameterSet &)
 
std::unique_ptr< LHCOpticalFunctionsSetCollectionproduce (const CTPPSOpticsRcd &)
 
 ~CTPPSOpticalFunctionsESSource () override=default
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 

Private Attributes

unsigned int m_currentEntry
 
bool m_currentEntryValid
 
std::vector< Entrym_entries
 
std::string m_label
 

Additional Inherited Members

- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Loads optical functions from ROOT files.

Definition at line 18 of file CTPPSOpticalFunctionsESSource.cc.

Constructor & Destructor Documentation

◆ CTPPSOpticalFunctionsESSource()

CTPPSOpticalFunctionsESSource::CTPPSOpticalFunctionsESSource ( const edm::ParameterSet conf)

Definition at line 58 of file CTPPSOpticalFunctionsESSource.cc.

References edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), m_entries, m_label, muonDTDigis_cfi::pset, edm::ESProducer::setWhatProduced(), and ctppsOpticalFunctions_non_DB_cff::validityRange.

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")) {
61  edm::EventRange validityRange = entry_pset.getParameter<edm::EventRange>("validityRange");
62 
63  std::vector<FileInfo> fileInfo;
64  for (const auto &pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>("opticalFunctions")) {
65  fileInfo.emplace_back(pset.getParameter<double>("xangle"),
66  pset.getParameter<edm::FileInPath>("fileName").fullPath());
67  }
68 
69  std::unordered_map<unsigned int, RPInfo> rpInfo;
70  for (const auto &pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>("scoringPlanes")) {
71  rpInfo.emplace(pset.getParameter<unsigned int>("rpId"),
72  RPInfo{pset.getParameter<std::string>("dirName"), pset.getParameter<double>("z")});
73  }
74 
75  m_entries.push_back({validityRange, fileInfo, rpInfo});
76  }
77 
78  setWhatProduced(this, m_label);
79  findingRecord<CTPPSOpticsRcd>();
80 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::string & fullPath() const
Definition: FileInPath.cc:144

◆ ~CTPPSOpticalFunctionsESSource()

CTPPSOpticalFunctionsESSource::~CTPPSOpticalFunctionsESSource ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void CTPPSOpticalFunctionsESSource::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 140 of file CTPPSOpticalFunctionsESSource.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), DiMuonV_cfg::config, submitPVResolutionJobs::desc, haddnano::of, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

140  {
142 
143  desc.add<std::string>("label", "")->setComment("label of the optics record");
144 
145  edm::ParameterSetDescription config_desc;
146 
147  config_desc.add<edm::EventRange>("validityRange", edm::EventRange())->setComment("interval of validity");
148 
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");
155 
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");
162 
163  std::vector<edm::ParameterSet> config;
164  desc.addVPSet("configuration", config_desc, sp)->setComment("list of configuration blocks");
165 
166  descriptions.add("ctppsOpticalFunctionsESSource", desc);
167 }
void setComment(std::string const &value)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
dictionary config
Read in AllInOne config in JSON format.
Definition: DiMuonV_cfg.py:30

◆ produce()

std::unique_ptr< LHCOpticalFunctionsSetCollection > CTPPSOpticalFunctionsESSource::produce ( const CTPPSOpticsRcd )

Definition at line 114 of file CTPPSOpticalFunctionsESSource.cc.

References mps_splice::entry, fcn(), m_currentEntry, m_currentEntryValid, m_entries, eostools::move(), and convertSQLitetoXML_cfg::output.

114  {
115  // prepare output, empty by default
116  auto output = std::make_unique<LHCOpticalFunctionsSetCollection>();
117 
118  // fill the output
119  if (m_currentEntryValid) {
120  const auto &entry = m_entries[m_currentEntry];
121 
122  for (const auto &fi : entry.m_fileInfo) {
123  std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
124 
125  for (const auto &rpi : entry.m_rpInfo) {
126  LHCOpticalFunctionsSet fcn(fi.m_fileName, rpi.second.m_dirName, rpi.second.m_scoringPlaneZ);
127  xa_data.emplace(rpi.first, std::move(fcn));
128  }
129 
130  output->emplace(fi.m_xangle, xa_data);
131  }
132  }
133 
134  // commit the output
135  return output;
136 }
Set of optical functions corresponding to one scoring plane along LHC.
void fcn(int &, double *, double &, double *, int)
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511

◆ setIntervalFor()

void CTPPSOpticalFunctionsESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 84 of file CTPPSOpticalFunctionsESSource.cc.

References edm::contains(), mps_fire::end, mps_splice::entry, edm::EventID::event(), edm::IOVSyncValue::eventID(), heavyIonCSV_trainingSettings::idx, edm::EventID::luminosityBlock(), m_currentEntry, m_currentEntryValid, m_entries, edm::EventID::run(), and isotrackNtupler::start.

86  {
87  for (unsigned int idx = 0; idx < m_entries.size(); ++idx) {
88  const auto &entry = m_entries[idx];
89 
90  // is within an entry ?
91  if (edm::contains(entry.m_validityRange, iosv.eventID())) {
92  m_currentEntryValid = true;
94  oValidity = edm::ValidityInterval(edm::IOVSyncValue(entry.m_validityRange.startEventID()),
95  edm::IOVSyncValue(entry.m_validityRange.endEventID()));
96  return;
97  }
98  }
99 
100  // not within any entry
101  m_currentEntryValid = false;
102  m_currentEntry = 0;
103 
104  edm::LogInfo("") << "No configuration entry found for event " << iosv.eventID()
105  << ", no optical functions will be available.";
106 
107  const edm::EventID start(iosv.eventID().run(), iosv.eventID().luminosityBlock(), iosv.eventID().event());
108  const edm::EventID end(iosv.eventID().run(), iosv.eventID().luminosityBlock(), iosv.eventID().event());
110 }
Definition: start.py:1
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
Log< level::Info, false > LogInfo
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
EventNumber_t event() const
Definition: EventID.h:40

Member Data Documentation

◆ m_currentEntry

unsigned int CTPPSOpticalFunctionsESSource::m_currentEntry
private

Definition at line 52 of file CTPPSOpticalFunctionsESSource.cc.

Referenced by produce(), and setIntervalFor().

◆ m_currentEntryValid

bool CTPPSOpticalFunctionsESSource::m_currentEntryValid
private

Definition at line 51 of file CTPPSOpticalFunctionsESSource.cc.

Referenced by produce(), and setIntervalFor().

◆ m_entries

std::vector<Entry> CTPPSOpticalFunctionsESSource::m_entries
private

◆ m_label

std::string CTPPSOpticalFunctionsESSource::m_label
private

Definition at line 31 of file CTPPSOpticalFunctionsESSource.cc.

Referenced by CTPPSOpticalFunctionsESSource().