CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder ()
 

Private Member Functions

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

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 &)
 

Detailed Description

Definition at line 11 of file EmptyESSource.cc.

Constructor & Destructor Documentation

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

Definition at line 38 of file EmptyESSource.cc.

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

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

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

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 69 of file EmptyESSource.cc.

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

71  {
73  //if no intervals given, fail immediately
74  if (setOfIOV_.size() == 0) {
75  return;
76  }
77 
78  std::pair< std::set<IOVSyncValue>::iterator,
79  std::set<IOVSyncValue>::iterator > itFound = setOfIOV_.equal_range(iTime);
80 
81  //we have overshot
82  if(itFound.first == itFound.second) {
83  if(itFound.first == setOfIOV_.begin()) {
84  //request is before first valid interval, so fail
85  return;
86  }
87  //go back one step
88  --itFound.first;
89  }
90  if (itFound.first == setOfIOV_.end()) {
91  return;
92  }
93 
94  IOVSyncValue endOfInterval = IOVSyncValue::endOfTime();
95 
96  if(itFound.second != setOfIOV_.end()) {
97  if(iovIsTime_) {
98  endOfInterval = IOVSyncValue(Timestamp(itFound.second->time().value() - 1));
99  } else {
100  endOfInterval = IOVSyncValue(itFound.second->eventID().previousRunLastEvent(0));
101  }
102  }
103  oInterval = ValidityInterval(*(itFound.first), endOfInterval);
104 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
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 35 of file EmptyESSource.cc.

Referenced by EmptyESSource(), and setIntervalFor().

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

Definition at line 33 of file EmptyESSource.cc.

Referenced by delaySettingRecords().

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

Definition at line 34 of file EmptyESSource.cc.

Referenced by EmptyESSource(), and setIntervalFor().