#include <EventSetup.h>
Public Member Functions | |
EventSetup (TFile *) | |
bool | exists (const char *iRecordName) const |
const Record & | get (const RecordID &) const |
std::vector< std::string > | namesOfAvailableRecords () const |
RecordID | recordID (const char *iRecordName) const |
void | syncTo (const edm::EventID &, const edm::Timestamp &) |
virtual | ~EventSetup () |
Private Member Functions | |
EventSetup (const EventSetup &) | |
const EventSetup & | operator= (const EventSetup &) |
Private Attributes | |
const edm::EventBase * | m_event |
TFile * | m_file |
std::vector< Record * > | m_records |
edm::EventID | m_syncedEvent |
edm::Timestamp | m_syncedTimestamp |
Definition at line 66 of file EventSetup.h.
EventSetup::EventSetup | ( | TFile * | iFile | ) |
Definition at line 39 of file EventSetup.cc.
EventSetup::~EventSetup | ( | ) | [virtual] |
Definition at line 50 of file EventSetup.cc.
References m_records.
fwlite::EventSetup::EventSetup | ( | const EventSetup & | ) | [private] |
bool EventSetup::exists | ( | const char * | iRecordName | ) | const |
Returns true if a record with the name iRecordName is available in the file
Definition at line 84 of file EventSetup.cc.
References kRecordAuxiliaryBranchName, m_file, VarParsing::obj, diffTreeTool::tree, and fwlite::unformat_mangled_to_type().
Referenced by main().
{ std::string realName = unformat_mangled_to_type(iRecordName); TObject* obj = m_file->Get(realName.c_str()); if(0==obj) { return false; } TTree* tree = dynamic_cast<TTree*>(obj); if(0==tree) { return false; } return 0 != tree->FindBranch(kRecordAuxiliaryBranchName); }
Definition at line 128 of file EventSetup.cc.
References m_records.
Referenced by main(), FWLiteESSource::registerProxies(), and FWLiteESSource::setIntervalFor().
std::vector< std::string > EventSetup::namesOfAvailableRecords | ( | ) | const |
Definition at line 135 of file EventSetup.cc.
References combine::key, relativeConstraints::keys, m_file, VarParsing::obj, and fwlite::unformat_mangled_to_type().
Referenced by FWLiteESSource::delaySettingRecords().
{ std::vector<std::string> returnValue; TList* keys = m_file->GetListOfKeys(); //this is ROOT's recommended way to iterate TIter next(keys); while(TObject* obj = next() ) { TKey* key = static_cast<TKey*> (obj); if(0==strcmp(key->GetClassName(),"TTree")) { returnValue.push_back(unformat_mangled_to_type(key->GetName())); } } return returnValue; }
const EventSetup& fwlite::EventSetup::operator= | ( | const EventSetup & | ) | [private] |
RecordID EventSetup::recordID | ( | const char * | iRecordName | ) | const |
Returns the lookup id of the record whose name is iRecordName. The returned id is only valid for the instance of an EventSetup object to which the recordID call was made. If you later create a new EventSetup instance even for the same file the RecordIDs can be different.
Definition at line 99 of file EventSetup.cc.
References Exception, fwlite::format_type_to_mangled(), kRecordAuxiliaryBranchName, m_file, m_records, mergeVDriftHistosByStation::name, VarParsing::obj, SiStripGain_Fake_cff::Record, and diffTreeTool::tree.
Referenced by FWLiteESSource::delaySettingRecords(), and main().
{ std::string treeName = format_type_to_mangled(iRecordName); TObject* obj = m_file->Get(treeName.c_str()); if(0==obj) { throw cms::Exception("UnknownRecord")<<"The TTree for the record "<<iRecordName<<" does not exist "<<m_file->GetName(); } TTree* tree = dynamic_cast<TTree*>(obj); if(0==tree) { throw cms::Exception("UnknownRecord")<<"The object corresponding to "<<iRecordName<<" in file "<<m_file->GetName()<<" is not a TTree and therefore is not a Record"; } if(0 == tree->FindBranch(kRecordAuxiliaryBranchName)) { throw cms::Exception("UnknownRecord")<<"The TTree corresponding to "<<iRecordName<<" in file "<<m_file->GetName()<<" does not have the proper structure to be a Record"; } //do we already have this Record? std::string name(iRecordName); for(std::vector<Record*>::iterator it = m_records.begin(), itEnd=m_records.end(); it!=itEnd;++it){ if((*it)->name()==name) { return it - m_records.begin(); } } //Not found so need to make a new one Record* rec = new Record(iRecordName, tree); m_records.push_back(rec); return m_records.size()-1; }
void EventSetup::syncTo | ( | const edm::EventID & | iID, |
const edm::Timestamp & | iTime | ||
) |
Ensures that all Records will access the appropriate data for this instant in time
Definition at line 74 of file EventSetup.cc.
References m_records, and fwlite::Record::syncTo().
Referenced by main(), and FWLiteESSource::setIntervalFor().
{ std::for_each(m_records.begin(), m_records.end(), boost::bind(&Record::syncTo,_1,iID,iTime)); }
const edm::EventBase* fwlite::EventSetup::m_event [private] |
Definition at line 105 of file EventSetup.h.
TFile* fwlite::EventSetup::m_file [private] |
Definition at line 109 of file EventSetup.h.
Referenced by exists(), namesOfAvailableRecords(), and recordID().
std::vector<Record*> fwlite::EventSetup::m_records [mutable, private] |
Definition at line 111 of file EventSetup.h.
Referenced by get(), recordID(), syncTo(), and ~EventSetup().
Definition at line 106 of file EventSetup.h.
Definition at line 107 of file EventSetup.h.