CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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 &)
 
 EmptyESSource (EmptyESSource const &)=delete
 
EmptyESSource const & operator= (EmptyESSource const &)=delete
 
void setIntervalFor (eventsetup::EventSetupRecordKey const &, IOVSyncValue const &iTime, ValidityInterval &oInterval) override
 
- 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 (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void delaySettingRecords () override
 

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 36 of file EmptyESSource.cc.

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

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

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 51 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_.

51  {
52  eventsetup::EventSetupRecordKey recordKey = eventsetup::EventSetupRecordKey::TypeTag::findType(recordName_);
53  if (recordKey == eventsetup::EventSetupRecordKey()) {
55  << " The Record type named \"" << recordName_ << "\" could not be found. Please check the spelling. \n"
56  << "If the spelling is fine, then no module in the job requires this Record and therefore EmptyESSource can "
57  "not function.\n"
58  "In such a case please either remove the EmptyESSource with label'"
59  << descriptionForFinder().label_ << "' from your job or add a module which needs the Record to your job.";
60  }
61  findingRecordWithKey(recordKey);
62  }
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_
void edm::EmptyESSource::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 101 of file EmptyESSource.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_EVENTSETUP_SOURCE, and AlCaHLTBitMon_QueryRunRegistry::string.

101  {
103  desc.add<std::string>("recordName")
104  ->setComment(
105  "The name of the EventSetup Record for which intervals are to be generated.\n The record type must be used "
106  "by some module in the job else an exception will occur.");
107  desc.add<bool>("iovIsRunNotTime", true)->setComment("Sets how to interpret integer values used in 'firstValid'");
108  desc.add<std::vector<unsigned int>>("firstValid")
109  ->setComment(
110  "Sets the beginning point of an IOV. The end point is assumed to be the next entry in the list. If there "
111  "are no further entries than 'end of time' is used.");
112 
113  descriptions.addDefault(desc);
114  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
EmptyESSource const& edm::EmptyESSource::operator= ( EmptyESSource const &  )
delete
void edm::EmptyESSource::setIntervalFor ( eventsetup::EventSetupRecordKey const &  ,
IOVSyncValue const &  iTime,
ValidityInterval oInterval 
)
override

Definition at line 64 of file EmptyESSource.cc.

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

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

Member Data Documentation

bool edm::EmptyESSource::iovIsTime_
private

Definition at line 33 of file EmptyESSource.cc.

Referenced by EmptyESSource(), and setIntervalFor().

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

Definition at line 31 of file EmptyESSource.cc.

Referenced by delaySettingRecords().

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

Definition at line 32 of file EmptyESSource.cc.

Referenced by EmptyESSource(), and setIntervalFor().