CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::EmptyESSource Class Reference

Inheritance diagram for edm::EmptyESSource:
edm::EventSetupRecordIntervalFinder

List of all members.

Public Member Functions

 EmptyESSource (ParameterSet const &)
void setIntervalFor (eventsetup::EventSetupRecordKey const &, IOVSyncValue const &iTime, ValidityInterval &oInterval)

Private Member Functions

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

Private Attributes

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

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 cond::rpcobtemp::temp.

                                                     :
     recordName_(pset.getParameter<std::string>("recordName")),
     iovIsTime_(!pset.getParameter<bool>("iovIsRunNotTime")) {
   std::vector<unsigned int> temp(pset.getParameter< std::vector<unsigned int> >("firstValid"));
   for(std::vector<unsigned int>::iterator itValue = temp.begin(), itValueEnd = temp.end();
        itValue != itValueEnd;
        ++itValue) {
      if(iovIsTime_) {
         setOfIOV_.insert(IOVSyncValue(Timestamp(*itValue)));
      } else {
         setOfIOV_.insert(IOVSyncValue(EventID(*itValue, 0, 0)));
      }
   }
   //copy_all(temp, inserter(setOfIOV_ , setOfIOV_.end()));
}
edm::EmptyESSource::EmptyESSource ( EmptyESSource const &  ) [private]

Member Function Documentation

void edm::EmptyESSource::delaySettingRecords ( ) [private, virtual]

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::typelookup::findType(), edm::eventsetup::ComponentDescription::label_, and recordName_.

                                   {
   eventsetup::EventSetupRecordKey recordKey = eventsetup::EventSetupRecordKey::TypeTag::findType(recordName_);
   if (recordKey == eventsetup::EventSetupRecordKey()) {
      throw edm::Exception(errors::Configuration) << " The Record type named \"" << recordName_
      << "\" could not be found. Please check the spelling. \n"
      << "If the spelling is fine, then no module in the job requires this Record and therefore EmptyESSource can not function.\n"
      "In such a case please either remove the EmptyESSource with label'"
      << descriptionForFinder().label_ << "' from your job or add a module which needs the Record to your job.";
   }
   findingRecordWithKey(recordKey);
}
EmptyESSource const& edm::EmptyESSource::operator= ( EmptyESSource const &  ) [private]
void edm::EmptyESSource::setIntervalFor ( eventsetup::EventSetupRecordKey const &  ,
IOVSyncValue const &  iTime,
ValidityInterval oInterval 
) [virtual]

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 69 of file EmptyESSource.cc.

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

                                                            {
   oInterval = ValidityInterval::invalidInterval();
   //if no intervals given, fail immediately
   if (setOfIOV_.size() == 0) {
      return;
   }
   
   std::pair< std::set<IOVSyncValue>::iterator, 
      std::set<IOVSyncValue>::iterator > itFound = setOfIOV_.equal_range(iTime);
   
   //we have overshot
   if(itFound.first == itFound.second) {
      if(itFound.first == setOfIOV_.begin()) {
         //request is before first valid interval, so fail
         return;
      }
      //go back one step
      --itFound.first;
   }
   if (itFound.first == setOfIOV_.end()) {
      return;
   }
   
   IOVSyncValue endOfInterval = IOVSyncValue::endOfTime();
   
   if(itFound.second != setOfIOV_.end()) {
      if(iovIsTime_) {
         endOfInterval = IOVSyncValue(Timestamp(itFound.second->time().value() - 1));
      } else {
         endOfInterval = IOVSyncValue(itFound.second->eventID().previousRunLastEvent(0));
      }
   }
   oInterval = ValidityInterval(*(itFound.first), endOfInterval);
}

Member Data Documentation

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().

Definition at line 34 of file EmptyESSource.cc.

Referenced by EmptyESSource(), and setIntervalFor().