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::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

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 ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
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::DataProxyProvider
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

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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 TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- 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 ( const edm::ParameterSet conf)

Definition at line 60 of file CTPPSOpticalFunctionsESSource.cc.

References TrackerOfflineValidation_Dqm_cff::dirName, mps_splice::entry, MillePedeFileConverter_cfg::fileName, edm::ParameterSet::getParameter(), m_entries, m_label, muonDTDigis_cfi::pset, year_2016_postTS2_cff::rpId, edm::ESProducer::setWhatProduced(), AlCaHLTBitMon_QueryRunRegistry::string, base_cff::validityRange, base_cff::xangle, and z.

60  :
61  m_label(conf.getParameter<std::string>("label")),
62  m_currentEntryValid(false),
64 {
65  for (const auto &entry_pset : conf.getParameter<std::vector<edm::ParameterSet>>("configuration"))
66  {
67  edm::EventRange validityRange = entry_pset.getParameter<edm::EventRange>("validityRange");
68 
69  std::vector<FileInfo> fileInfo;
70  for (const auto &pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>("opticalFunctions"))
71  {
72  const double &xangle = pset.getParameter<double>("xangle");
73  const std::string &fileName = pset.getParameter<edm::FileInPath>("fileName").fullPath();
74  fileInfo.push_back({xangle, fileName});
75  }
76 
77  std::unordered_map<unsigned int, RPInfo> rpInfo;
78  for (const auto &pset : entry_pset.getParameter<std::vector<edm::ParameterSet>>("scoringPlanes"))
79  {
80  const unsigned int rpId = pset.getParameter<unsigned int>("rpId");
81  const std::string dirName = pset.getParameter<std::string>("dirName");
82  const double z = pset.getParameter<double>("z");
83  const RPInfo entry = {dirName, z};
84  rpInfo.emplace(rpId, entry);
85  }
86 
87  m_entries.push_back({validityRange, fileInfo, rpInfo});
88  }
89 
90  setWhatProduced(this, m_label);
91  findingRecord<CTPPSOpticsRcd>();
92 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
validityRange
Definition: base_cff.py:18
CTPPSOpticalFunctionsESSource::~CTPPSOpticalFunctionsESSource ( )
overridedefault

Member Function Documentation

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

Definition at line 158 of file CTPPSOpticalFunctionsESSource.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), looper::config, DEFINE_FWK_EVENTSETUP_SOURCE, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

159 {
161 
162  desc.add<std::string>("label", "")->setComment("label of the optics record");
163 
164  edm::ParameterSetDescription config_desc;
165 
166  config_desc.add<edm::EventRange>("validityRange", edm::EventRange())->setComment("interval of validity");
167 
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");
173 
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");
180 
181  std::vector<edm::ParameterSet> config;
182  desc.addVPSet("configuration", config_desc, sp)->setComment("list of configuration blocks");
183 
184  descriptions.add("ctppsOpticalFunctionsESSource", desc);
185 }
void setComment(std::string const &value)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
config
Definition: looper.py:291
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< LHCOpticalFunctionsSetCollection > CTPPSOpticalFunctionsESSource::produce ( const CTPPSOpticsRcd )

Definition at line 127 of file CTPPSOpticalFunctionsESSource.cc.

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

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

128 {
129  // prepare output, empty by default
130  auto output = std::make_unique<LHCOpticalFunctionsSetCollection>();
131 
132  // fill the output
134  {
135  const auto &entry = m_entries[m_currentEntry];
136 
137  for (const auto &fi : entry.m_fileInfo)
138  {
139  std::unordered_map<unsigned int, LHCOpticalFunctionsSet> xa_data;
140 
141  for (const auto &rpi : entry.m_rpInfo)
142  {
143  LHCOpticalFunctionsSet fcn(fi.m_fileName, rpi.second.m_dirName, rpi.second.m_scoringPlaneZ);
144  xa_data.emplace(rpi.first, std::move(fcn));
145  }
146 
147  output->emplace(fi.m_xangle, xa_data);
148  }
149  }
150 
151  // commit the output
152  return output;
153 }
Set of optical functions corresponding to one scoring plane along LHC.
void fcn(int &, double *, double &, double *, int)
def move(src, dest)
Definition: eostools.py:511
void CTPPSOpticalFunctionsESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval oValidity 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 96 of file CTPPSOpticalFunctionsESSource.cc.

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

98 {
99  for (unsigned int idx = 0; idx < m_entries.size(); ++idx)
100  {
101  const auto &entry = m_entries[idx];
102 
103  // is within an entry ?
104  if (edm::contains(entry.m_validityRange, iosv.eventID()))
105  {
106  m_currentEntryValid = true;
108  oValidity = edm::ValidityInterval(edm::IOVSyncValue(entry.m_validityRange.startEventID()), edm::IOVSyncValue(entry.m_validityRange.endEventID()));
109  return;
110  }
111  }
112 
113  // not within any entry
114  m_currentEntryValid = false;
115  m_currentEntry = 0;
116 
117  edm::LogInfo("") << "No configuration entry found for event " << iosv.eventID() << ", no optical functions will be available.";
118 
119  const edm::EventID start(iosv.eventID().run(), iosv.eventID().luminosityBlock(), iosv.eventID().event());
120  const edm::EventID end(iosv.eventID().run(), iosv.eventID().luminosityBlock(), iosv.eventID().event());
122 }
RunNumber_t run() const
Definition: EventID.h:39
Definition: start.py:1
EventNumber_t event() const
Definition: EventID.h:41
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
#define end
Definition: vmac.h:39

Member Data Documentation

unsigned int CTPPSOpticalFunctionsESSource::m_currentEntry
private

Definition at line 54 of file CTPPSOpticalFunctionsESSource.cc.

Referenced by produce(), and setIntervalFor().

bool CTPPSOpticalFunctionsESSource::m_currentEntryValid
private

Definition at line 53 of file CTPPSOpticalFunctionsESSource.cc.

Referenced by produce(), and setIntervalFor().

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

Definition at line 30 of file CTPPSOpticalFunctionsESSource.cc.

Referenced by CTPPSOpticalFunctionsESSource().