CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::EmptyESSource Class Reference
Inheritance diagram for edm::EmptyESSource:
edm::EventSetupRecordIntervalFinder

Public Member Functions

 EmptyESSource (ParameterSet const &)
 
void setIntervalFor (eventsetup::EventSetupRecordKey const &, IOVSyncValue const &iTime, ValidityInterval &oInterval) override
 
- 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)
 

Private Member Functions

void delaySettingRecords () override
 
 EmptyESSource (EmptyESSource const &)=delete
 
EmptyESSource const & operator= (EmptyESSource const &)=delete
 

Private Attributes

bool iovIsTime_
 
std::string recordName_
 
std::set< IOVSyncValuesetOfIOV_
 

Additional Inherited Members

- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 
virtual void setIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &, ValidityInterval &)=0
 

Detailed Description

Definition at line 11 of file EmptyESSource.cc.

Constructor & Destructor Documentation

edm::EmptyESSource::EmptyESSource ( ParameterSet const &  pset)

Definition at line 37 of file EmptyESSource.cc.

References edm::ParameterSet::getParameter(), iovIsTime_, setOfIOV_, and groupFilesInBlocks::temp.

38  : recordName_(pset.getParameter<std::string>("recordName")),
39  iovIsTime_(!pset.getParameter<bool>("iovIsRunNotTime")) {
40  std::vector<unsigned int> temp(pset.getParameter<std::vector<unsigned int> >("firstValid"));
41  for (std::vector<unsigned int>::iterator itValue = temp.begin(), itValueEnd = temp.end(); itValue != itValueEnd;
42  ++itValue) {
43  if (iovIsTime_) {
44  setOfIOV_.insert(IOVSyncValue(Timestamp(*itValue)));
45  } else {
46  setOfIOV_.insert(IOVSyncValue(EventID(*itValue, 0, 0)));
47  }
48  }
49  //copy_all(temp, inserter(setOfIOV_ , setOfIOV_.end()));
50  }
std::set< IOVSyncValue > setOfIOV_
std::string recordName_
edm::EmptyESSource::EmptyESSource ( EmptyESSource const &  )
privatedelete

Member Function Documentation

void edm::EmptyESSource::delaySettingRecords ( )
overrideprivatevirtual

override this method if you need to delay setting what records you will be using until after all modules are loaded

Reimplemented from edm::EventSetupRecordIntervalFinder.

Definition at line 52 of file EmptyESSource.cc.

References edm::errors::Configuration, edm::EventSetupRecordIntervalFinder::descriptionForFinder(), Exception, edm::EventSetupRecordIntervalFinder::findingRecordWithKey(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::eventsetup::ComponentDescription::label_, and recordName_.

52  {
53  eventsetup::EventSetupRecordKey recordKey = eventsetup::EventSetupRecordKey::TypeTag::findType(recordName_);
54  if (recordKey == eventsetup::EventSetupRecordKey()) {
56  << " The Record type named \"" << recordName_ << "\" could not be found. Please check the spelling. \n"
57  << "If the spelling is fine, then no module in the job requires this Record and therefore EmptyESSource can "
58  "not function.\n"
59  "In such a case please either remove the EmptyESSource with label'"
60  << descriptionForFinder().label_ << "' from your job or add a module which needs the Record to your job.";
61  }
62  findingRecordWithKey(recordKey);
63  }
const eventsetup::ComponentDescription & descriptionForFinder() const
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
void findingRecordWithKey(const eventsetup::EventSetupRecordKey &)
std::string recordName_
EmptyESSource const& edm::EmptyESSource::operator= ( EmptyESSource const &  )
privatedelete
void edm::EmptyESSource::setIntervalFor ( eventsetup::EventSetupRecordKey const &  ,
IOVSyncValue const &  iTime,
ValidityInterval oInterval 
)
override

Definition at line 65 of file EmptyESSource.cc.

References DEFINE_FWK_EVENTSETUP_SOURCE, edm::IOVSyncValue::endOfTime(), edm::ValidityInterval::invalidInterval(), iovIsTime_, and setOfIOV_.

67  {
69  //if no intervals given, fail immediately
70  if (setOfIOV_.empty()) {
71  return;
72  }
73 
74  std::pair<std::set<IOVSyncValue>::iterator, std::set<IOVSyncValue>::iterator> itFound =
75  setOfIOV_.equal_range(iTime);
76 
77  //we have overshot
78  if (itFound.first == itFound.second) {
79  if (itFound.first == setOfIOV_.begin()) {
80  //request is before first valid interval, so fail
81  return;
82  }
83  //go back one step
84  --itFound.first;
85  }
86  if (itFound.first == setOfIOV_.end()) {
87  return;
88  }
89 
90  IOVSyncValue endOfInterval = IOVSyncValue::endOfTime();
91 
92  if (itFound.second != setOfIOV_.end()) {
93  if (iovIsTime_) {
94  endOfInterval = IOVSyncValue(Timestamp(itFound.second->time().value() - 1));
95  } else {
96  endOfInterval = IOVSyncValue(itFound.second->eventID().previousRunLastEvent(0));
97  }
98  }
99  oInterval = ValidityInterval(*(itFound.first), endOfInterval);
100  }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::set< IOVSyncValue > setOfIOV_
static const ValidityInterval & invalidInterval()

Member Data Documentation

bool edm::EmptyESSource::iovIsTime_
private

Definition at line 34 of file EmptyESSource.cc.

Referenced by EmptyESSource(), and setIntervalFor().

std::string edm::EmptyESSource::recordName_
private

Definition at line 32 of file EmptyESSource.cc.

Referenced by delaySettingRecords().

std::set<IOVSyncValue> edm::EmptyESSource::setOfIOV_
private

Definition at line 33 of file EmptyESSource.cc.

Referenced by EmptyESSource(), and setIntervalFor().