CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
CTPPSRPAlignmentCorrectionsDataESSourceXML Class Reference
Inheritance diagram for CTPPSRPAlignmentCorrectionsDataESSourceXML:
edm::ESProducer edm::EventSetupRecordIntervalFinder edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 CTPPSRPAlignmentCorrectionsDataESSourceXML (const edm::ParameterSet &p)
 
 ~CTPPSRPAlignmentCorrectionsDataESSourceXML () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
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
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)
 

Protected Member Functions

std::unique_ptr< CTPPSRPAlignmentCorrectionsDataproduceMeasured (const CTPPSRPAlignmentCorrectionsDataRcd &)
 
std::unique_ptr< CTPPSRPAlignmentCorrectionsDataproduceMisaligned (const RPMisalignedAlignmentRecord &)
 
std::unique_ptr< CTPPSRPAlignmentCorrectionsDataproduceReal (const RPRealAlignmentRecord &)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 
- Protected Member Functions inherited from edm::ESProducer
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={})
 
void usesResources (std::vector< std::string > const &)
 
- 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 EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
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 &)
 

Protected Attributes

std::unique_ptr< CTPPSRPAlignmentCorrectionsDataESSourceXMLCommonctppsRPAlignmentCorrectionsDataESSourceXMLCommon
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 

Detailed Description

Loads alignment corrections to EventSetup.

Definition at line 39 of file CTPPSRPAlignmentCorrectionsDataESSourceXML.cc.

Constructor & Destructor Documentation

◆ CTPPSRPAlignmentCorrectionsDataESSourceXML()

CTPPSRPAlignmentCorrectionsDataESSourceXML::CTPPSRPAlignmentCorrectionsDataESSourceXML ( const edm::ParameterSet p)

Definition at line 58 of file CTPPSRPAlignmentCorrectionsDataESSourceXML.cc.

References produceMeasured(), produceMisaligned(), and produceReal().

58  {
60  std::make_unique<CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon>(pSet);
64 
65  findingRecord<CTPPSRPAlignmentCorrectionsDataRcd>();
66  findingRecord<RPRealAlignmentRecord>();
67  findingRecord<RPMisalignedAlignmentRecord>();
68 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
std::unique_ptr< CTPPSRPAlignmentCorrectionsData > produceMeasured(const CTPPSRPAlignmentCorrectionsDataRcd &)
std::unique_ptr< CTPPSRPAlignmentCorrectionsData > produceMisaligned(const RPMisalignedAlignmentRecord &)
std::unique_ptr< CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon > ctppsRPAlignmentCorrectionsDataESSourceXMLCommon
std::unique_ptr< CTPPSRPAlignmentCorrectionsData > produceReal(const RPRealAlignmentRecord &)

◆ ~CTPPSRPAlignmentCorrectionsDataESSourceXML()

CTPPSRPAlignmentCorrectionsDataESSourceXML::~CTPPSRPAlignmentCorrectionsDataESSourceXML ( )
override

Definition at line 72 of file CTPPSRPAlignmentCorrectionsDataESSourceXML.cc.

72 {}

Member Function Documentation

◆ produceMeasured()

std::unique_ptr< CTPPSRPAlignmentCorrectionsData > CTPPSRPAlignmentCorrectionsDataESSourceXML::produceMeasured ( const CTPPSRPAlignmentCorrectionsDataRcd iRecord)
protected

Definition at line 76 of file CTPPSRPAlignmentCorrectionsDataESSourceXML.cc.

Referenced by CTPPSRPAlignmentCorrectionsDataESSourceXML().

77  {
78  return std::make_unique<CTPPSRPAlignmentCorrectionsData>(
80 }
std::unique_ptr< CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon > ctppsRPAlignmentCorrectionsDataESSourceXMLCommon

◆ produceMisaligned()

std::unique_ptr< CTPPSRPAlignmentCorrectionsData > CTPPSRPAlignmentCorrectionsDataESSourceXML::produceMisaligned ( const RPMisalignedAlignmentRecord iRecord)
protected

Definition at line 91 of file CTPPSRPAlignmentCorrectionsDataESSourceXML.cc.

Referenced by CTPPSRPAlignmentCorrectionsDataESSourceXML().

92  {
93  return std::make_unique<CTPPSRPAlignmentCorrectionsData>(
95 }
std::unique_ptr< CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon > ctppsRPAlignmentCorrectionsDataESSourceXMLCommon

◆ produceReal()

std::unique_ptr< CTPPSRPAlignmentCorrectionsData > CTPPSRPAlignmentCorrectionsDataESSourceXML::produceReal ( const RPRealAlignmentRecord iRecord)
protected

Definition at line 84 of file CTPPSRPAlignmentCorrectionsDataESSourceXML.cc.

Referenced by CTPPSRPAlignmentCorrectionsDataESSourceXML().

85  {
86  return std::make_unique<CTPPSRPAlignmentCorrectionsData>(ctppsRPAlignmentCorrectionsDataESSourceXMLCommon->acReal);
87 }
std::unique_ptr< CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon > ctppsRPAlignmentCorrectionsDataESSourceXMLCommon

◆ setIntervalFor()

void CTPPSRPAlignmentCorrectionsDataESSourceXML::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey key,
const edm::IOVSyncValue iosv,
edm::ValidityInterval valInt 
)
overrideprotectedvirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 99 of file CTPPSRPAlignmentCorrectionsDataESSourceXML.cc.

References edm::IOVSyncValue::endOfTime(), edm::IOVSyncValue::eventID(), Exception, edm::ValidityInterval::first(), CTPPSRPAlignmentCorrectionsMethods::iovValueToString(), crabWrapper::key, edm::ValidityInterval::last(), edm::EventID::luminosityBlock(), edm::EventID::maxLuminosityBlockNumber(), edm::EventID::maxRunNumber(), edm::EventID::run(), edm::IOVSyncValue::time(), and edm::Timestamp::unixTime().

101  {
103  time_t unixTime = iosv.time().unixTime();
104  char timeStr[50];
105  strftime(timeStr, 50, "%F %T", localtime(&unixTime));
106 
107  LogInfo("PPS") << ">> CTPPSRPAlignmentCorrectionsDataESSourceXML::setIntervalFor(" << key.name() << ")";
108 
109  LogInfo("PPS") << " event=" << iosv.eventID() << ", UNIX timestamp=" << unixTime << " (" << timeStr << ")";
110  }
111 
112  // // determine what sequence and corrections should be used
114  CTPPSRPAlignmentCorrectionsData *p_corr = nullptr;
115 
116  if (strcmp(key.name(), "CTPPSRPAlignmentCorrectionsDataRcd") == 0) {
117  p_seq = &(ctppsRPAlignmentCorrectionsDataESSourceXMLCommon->acsMeasured);
118  p_corr = &(ctppsRPAlignmentCorrectionsDataESSourceXMLCommon->acMeasured);
119  }
120 
121  if (strcmp(key.name(), "RPRealAlignmentRecord") == 0) {
124  }
125 
126  if (strcmp(key.name(), "RPMisalignedAlignmentRecord") == 0) {
127  p_seq = &(ctppsRPAlignmentCorrectionsDataESSourceXMLCommon->acsMisaligned);
128  p_corr = &(ctppsRPAlignmentCorrectionsDataESSourceXMLCommon->acMisaligned);
129  }
130 
131  if (p_corr == nullptr)
132  throw cms::Exception("CTPPSRPAlignmentCorrectionsDataESSourceXML::setIntervalFor")
133  << "Unknown record " << key.name();
134 
135  // // find the corresponding interval
136  bool next_exists = false;
137  const edm::EventID &event_curr = iosv.eventID();
139 
140  for (const auto &it : *p_seq) {
141  const auto &it_event_first = it.first.first().eventID();
142  const auto &it_event_last = it.first.last().eventID();
143 
144  bool it_contained_lo = ((it_event_first.run() < event_curr.run()) ||
145  ((it_event_first.run() == event_curr.run()) &&
146  (it_event_first.luminosityBlock() <= event_curr.luminosityBlock())));
147 
148  bool it_contained_up = ((it_event_last.run() > event_curr.run()) ||
149  ((it_event_last.run() == event_curr.run()) &&
150  (it_event_last.luminosityBlock() >= event_curr.luminosityBlock())));
151 
152  if (it_contained_lo && it_contained_up) {
153  valInt = it.first;
154  *p_corr = it.second;
155 
157  LogInfo("PPS") << " setting validity interval ["
160  }
161 
162  return;
163  }
164 
165  bool it_in_future = ((it_event_first.run() > event_curr.run()) ||
166  ((it_event_first.run() == event_curr.run() &&
167  (it_event_first.luminosityBlock() > event_curr.luminosityBlock()))));
168 
169  if (it_in_future) {
170  next_exists = true;
171  if (event_next_start > it_event_first)
172  event_next_start = it_event_first;
173  }
174  }
175 
176  // no interval found, set empty corrections
178 
179  if (!next_exists) {
180  valInt = ValidityInterval(iosv, iosv.endOfTime());
181  } else {
182  const EventID &event_last = ctppsRPAlignmentCorrectionsDataESSourceXMLCommon->previousLS(event_next_start);
183  valInt = ValidityInterval(iosv, IOVSyncValue(event_last));
184  }
185 
187  LogInfo("PPS") << " setting validity interval ["
190  << "] (empty alignment corrections)";
191  }
192 }
const IOVSyncValue & last() const
const IOVSyncValue & first() const
static RunNumber_t maxRunNumber()
Definition: EventID.h:92
Time sequence of alignment corrections. I/O methods have been factored out to: CondFormats/PPSObjects...
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:17
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94
std::unique_ptr< CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon > ctppsRPAlignmentCorrectionsDataESSourceXMLCommon
static std::string iovValueToString(const edm::IOVSyncValue &)
Log< level::Info, false > LogInfo
RunNumber_t run() const
Definition: EventID.h:38
const EventID & eventID() const
Definition: IOVSyncValue.h:40
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
const Timestamp & time() const
Definition: IOVSyncValue.h:42
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:40

Member Data Documentation

◆ ctppsRPAlignmentCorrectionsDataESSourceXMLCommon

std::unique_ptr<CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon> CTPPSRPAlignmentCorrectionsDataESSourceXML::ctppsRPAlignmentCorrectionsDataESSourceXMLCommon
protected