CMS 3D CMS Logo

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

Public Member Functions

 FWLiteESSource (edm::ParameterSet const &iPS)
 
void newInterval (const edm::eventsetup::EventSetupRecordKey &iRecordType, const edm::ValidityInterval &iInterval) override
 called when a new interval of validity occurs for iRecordType More...
 
 ~FWLiteESSource () override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
virtual void updateLookup (ESRecordsToProxyIndices const &)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- 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
 
 FWLiteESSource (const FWLiteESSource &)=delete
 
const FWLiteESSourceoperator= (const FWLiteESSource &)=delete
 
void registerProxies (const edm::eventsetup::EventSetupRecordKey &iRecordKey, KeyedProxies &aProxyList) override
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
 

Private Attributes

fwlite::EventSetup m_es
 
std::unique_ptr< TFile > m_file
 
std::map< edm::eventsetup::EventSetupRecordKey, fwlite::RecordIDm_keyToID
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 99 of file FWLiteESSource.cc.

Constructor & Destructor Documentation

FWLiteESSource::FWLiteESSource ( edm::ParameterSet const &  iPS)

Definition at line 148 of file FWLiteESSource.cc.

148  :
149 m_file( TFile::Open(iPS.getParameter<std::string>("fileName").c_str())),
150 m_es( m_file.get())
151 {
152 }
std::unique_ptr< TFile > m_file
fwlite::EventSetup m_es
FWLiteESSource::~FWLiteESSource ( )
override

Definition at line 159 of file FWLiteESSource.cc.

160 {
161 }
FWLiteESSource::FWLiteESSource ( const FWLiteESSource )
privatedelete

Member Function Documentation

void FWLiteESSource::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 238 of file FWLiteESSource.cc.

References DEFINE_FWK_EVENTSETUP_SOURCE, edm::EventSetupRecordIntervalFinder::findingRecordWithKey(), edm::typelookup::findType(), crabWrapper::key, m_es, m_keyToID, fwlite::EventSetup::namesOfAvailableRecords(), fwlite::EventSetup::recordID(), lumiQTWidget::t, and edm::eventsetup::DataProxyProvider::usingRecordWithKey().

239 {
241  std::vector<std::string> recordNames = m_es.namesOfAvailableRecords();
242 
243  for(std::vector<std::string>::const_iterator it = recordNames.begin(),
244  itEnd = recordNames.end();
245  it != itEnd;
246  ++it) {
247  HCTypeTag t = HCTypeTag::findType(*it);
248  if(t != HCTypeTag() ) {
252  m_keyToID[key]=m_es.recordID(it->c_str());
253  }
254  }
255 }
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
Definition: typelookup.cc:69
std::vector< std::string > namesOfAvailableRecords() const
Definition: EventSetup.cc:133
std::map< edm::eventsetup::EventSetupRecordKey, fwlite::RecordID > m_keyToID
void usingRecordWithKey(const EventSetupRecordKey &)
fwlite::EventSetup m_es
RecordID recordID(const char *iRecordName) const
Definition: EventSetup.cc:97
void findingRecordWithKey(const eventsetup::EventSetupRecordKey &)
void FWLiteESSource::newInterval ( const edm::eventsetup::EventSetupRecordKey iRecordType,
const edm::ValidityInterval iInterval 
)
overridevirtual

called when a new interval of validity occurs for iRecordType

Implements edm::eventsetup::DataProxyProvider.

Definition at line 179 of file FWLiteESSource.cc.

References edm::eventsetup::DataProxyProvider::invalidateProxies().

181 {
182  invalidateProxies(iRecordType);
183 }
void invalidateProxies(const EventSetupRecordKey &iRecordKey)
const FWLiteESSource& FWLiteESSource::operator= ( const FWLiteESSource )
privatedelete
void FWLiteESSource::registerProxies ( const edm::eventsetup::EventSetupRecordKey iRecordKey,
KeyedProxies aProxyList 
)
overrideprivatevirtual

Implements edm::eventsetup::DataProxyProvider.

Definition at line 189 of file FWLiteESSource.cc.

References gather_cfg::cout, edm::typelookup::findType(), fwlite::EventSetup::get(), LogDebug, m_es, m_keyToID, edm::eventsetup::EventSetupRecordKey::name(), groupFilesInBlocks::tt, and fwlite::Record::typeAndLabelOfAvailableData().

191 {
193 
194  fwlite::RecordID recID = m_keyToID[iRecordKey];
195  const fwlite::Record& rec = m_es.get(recID);
196  typedef std::vector<std::pair<std::string,std::string> > TypesAndLabels;
197  TypesAndLabels typesAndLabels = rec.typeAndLabelOfAvailableData();
198 
199  std::cout <<"Looking for data in record "<<iRecordKey.name()<<std::endl;
200  for(TypesAndLabels::const_iterator it = typesAndLabels.begin(), itEnd = typesAndLabels.end();
201  it != itEnd;
202  ++it) {
203  std::cout <<" need type "<<it->first<<std::endl;
204  HCTypeTag tt = HCTypeTag::findType(it->first);
205  if(tt != HCTypeTag() ) {
206  edm::eventsetup::DataKey dk(tt,edm::eventsetup::IdTags(it->second.c_str()));
207  aProxyList.push_back(std::make_pair(dk,
208  std::make_shared<FWLiteProxy>(TypeID(tt.value()),&rec)));
209  } else {
210  LogDebug("UnknownESType")<<"The type '"<<it->first<<"' is unknown in this job";
211  std::cout <<" *****FAILED*****"<<std::endl;
212  }
213  }
214 
215 }
#define LogDebug(id)
std::pair< const char *, const std::type_info * > findType(const char *iClassName)
Definition: typelookup.cc:69
std::map< edm::eventsetup::EventSetupRecordKey, fwlite::RecordID > m_keyToID
unsigned int RecordID
Definition: EventSetup.h:64
fwlite::EventSetup m_es
std::vector< std::pair< std::string, std::string > > typeAndLabelOfAvailableData() const
Definition: Record.cc:236
const Record & get(const RecordID &) const
Definition: EventSetup.cc:126
void FWLiteESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey iKey,
const edm::IOVSyncValue iSync,
edm::ValidityInterval oIOV 
)
overrideprivatevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 219 of file FWLiteESSource.cc.

References edm::IOVSyncValue::endOfTime(), fwlite::Record::endSyncValue(), edm::IOVSyncValue::eventID(), fwlite::IOVSyncValue::eventID(), fwlite::EventSetup::get(), m_es, m_keyToID, edm::EventID::run(), fwlite::Record::startSyncValue(), fwlite::EventSetup::syncTo(), edm::IOVSyncValue::time(), fwlite::IOVSyncValue::time(), and edm::Timestamp::value().

222 {
223  m_es.syncTo(iSync.eventID(), iSync.time());
224 
225  const fwlite::Record& rec = m_es.get(m_keyToID[iKey]);
226  edm::IOVSyncValue endSync(rec.endSyncValue().eventID(),
227  rec.endSyncValue().time());
228  if(rec.endSyncValue().eventID().run()==0 &&
229  rec.endSyncValue().time().value() == 0ULL) {
230  endSync = edm::IOVSyncValue::endOfTime();
231  }
233  rec.startSyncValue().time()),
234  endSync);
235 }
RunNumber_t run() const
Definition: EventID.h:39
void syncTo(const edm::EventID &, const edm::Timestamp &)
Definition: EventSetup.cc:71
const EventID & eventID() const
Definition: IOVSyncValue.h:40
std::map< edm::eventsetup::EventSetupRecordKey, fwlite::RecordID > m_keyToID
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
const IOVSyncValue & startSyncValue() const
Definition: Record.cc:166
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
fwlite::EventSetup m_es
const edm::Timestamp & time() const
Definition: IOVSyncValue.h:44
const Timestamp & time() const
Definition: IOVSyncValue.h:42
const Record & get(const RecordID &) const
Definition: EventSetup.cc:126
TimeValue_t value() const
Definition: Timestamp.h:56
const edm::EventID & eventID() const
Definition: IOVSyncValue.h:42
const IOVSyncValue & endSyncValue() const
Definition: Record.cc:170

Member Data Documentation

fwlite::EventSetup FWLiteESSource::m_es
private

Definition at line 131 of file FWLiteESSource.cc.

Referenced by delaySettingRecords(), registerProxies(), and setIntervalFor().

std::unique_ptr<TFile> FWLiteESSource::m_file
private

Definition at line 130 of file FWLiteESSource.cc.

std::map<edm::eventsetup::EventSetupRecordKey, fwlite::RecordID> FWLiteESSource::m_keyToID
private

Definition at line 132 of file FWLiteESSource.cc.

Referenced by delaySettingRecords(), registerProxies(), and setIntervalFor().