CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
fwlite::Event Class Reference

#include <Event.h>

Inheritance diagram for fwlite::Event:
fwlite::EventBase edm::EventBase

Public Member Functions

bool atEnd () const override
 
void draw (Option_t *opt)
 Properly setup for edm::Ref, etc and then call TTree method. More...
 
Long64_t draw (char const *varexp, const TCut &selection, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0)
 
Long64_t draw (char const *varexp, char const *selection, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0)
 
 Event (TFile *iFile, bool useCache=true, std::function< void(TBranch const &)> baFunc=[](TBranch const &){})
 
edm::EventAuxiliary const & eventAuxiliary () const override
 
std::vector< edm::BranchDescription > const & getBranchDescriptions () const
 
std::string const getBranchNameFor (std::type_info const &, char const *iModuleLabel, char const *iProductInstanceLabel, char const *iProcessName) const override
 Return the branch name in the TFile which contains the data. More...
 
bool getByLabel (std::type_info const &, char const *, char const *, char const *, void *) const override
 This function should only be called by fwlite::Handle<> More...
 
edm::WrapperBase const * getByProductID (edm::ProductID const &) const override
 
fwlite::LuminosityBlock const & getLuminosityBlock () const
 
std::vector< std::string > const & getProcessHistory () const
 
fwlite::Run const & getRun () const
 
TFile * getTFile () const
 
edm::WrapperBase const * getThinnedProduct (edm::ProductID const &pid, unsigned int &key) const
 
void getThinnedProducts (edm::ProductID const &pid, std::vector< edm::WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const
 
Long64_t indexFromEventId (edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event)
 Find index of given event-id. More...
 
bool isValid () const
 
 operator bool () const
 
Event const & operator++ () override
 Advance to next event in the TFile. More...
 
edm::ParameterSet const * parameterSet (edm::ParameterSetID const &psID) const override
 
edm::ProcessHistory const & processHistory () const override
 
Long64_t scan (char const *varexp="", char const *selection="", Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0)
 
Long64_t size () const
 Returns number of events in the file. More...
 
bool to (Long64_t iIndex)
 Go to the event at index iIndex. More...
 
bool to (const edm::EventID &id)
 Go to event by Run & Event number. More...
 
bool to (edm::RunNumber_t run, edm::EventNumber_t event)
 
bool to (edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event)
 
Event const & toBegin () override
 Go to the very first Event. More...
 
edm::TriggerNames const & triggerNames (edm::TriggerResults const &triggerResults) const override
 
edm::TriggerResultsByName triggerResultsByName (edm::TriggerResults const &triggerResults) const override
 
 ~Event () override
 
- Public Member Functions inherited from fwlite::EventBase
 EventBase ()
 
virtual Long64_t fileIndex () const
 
virtual Long64_t secondaryFileIndex () const
 
 ~EventBase () override
 
- Public Member Functions inherited from edm::EventBase
int bunchCrossing () const
 
 EventBase ()
 
edm::EventAuxiliary::ExperimentType experimentType () const
 
template<typename T >
bool get (ProductID const &, Handle< T > &) const
 
template<typename T >
bool getByLabel (InputTag const &, Handle< T > &) const
 
template<>
bool getByLabel (edm::InputTag const &tag, Handle< FWGenericObject > &result) const
 Specialize the getByLabel method to work with a Handle<FWGenericObject> More...
 
edm::EventID id () const
 
bool isRealData () const
 
edm::LuminosityBlockNumber_t luminosityBlock () const
 
int orbitNumber () const
 
edm::Timestamp time () const
 

Static Public Member Functions

static void throwProductNotFoundException (std::type_info const &, char const *, char const *, char const *)
 

Private Member Functions

 Event (Event const &)=delete
 
void fillParameterSetRegistry () const
 
edm::ProcessHistory const & history () const
 
Event const & operator= (Event const &)=delete
 
void setGetter (std::shared_ptr< edm::EDProductGetter const > getter)
 
void updateAux (Long_t eventIndex) const
 

Private Attributes

edm::EventAuxiliary aux_
 
TBranch * auxBranch_
 
fwlite::BranchMapReader branchMap_
 
fwlite::DataGetterHelper dataHelper_
 
EntryFinder entryFinder_
 
TTree * eventHistoryTree_
 
std::vector< edm::EventProcessHistoryIDeventProcessHistoryIDs_
 
TFile * file_
 
int fileVersion_
 
edm::ProcessHistoryMap historyMap_
 
std::vector< char const * > labels_
 
std::shared_ptr< fwlite::LuminosityBlocklumi_
 
bool parameterSetRegistryFilled_
 
edm::EventAuxiliary const * pAux_
 
edm::EventAux const * pOldAux_
 
std::vector< std::string > procHistoryNames_
 
std::shared_ptr< fwlite::Runrun_
 
std::shared_ptr< RunFactoryrunFactory_
 

Friends

class ChainEvent
 
class EventHistoryGetter
 
class internal::ProductGetter
 

Additional Inherited Members

- Static Protected Member Functions inherited from edm::EventBase
static edm::ParameterSet const * parameterSetForID_ (edm::ParameterSetID const &psID)
 
static TriggerNames const * triggerNames_ (edm::TriggerResults const &triggerResults)
 

Detailed Description

Definition at line 85 of file Event.h.

Constructor & Destructor Documentation

Event::Event ( TFile *  iFile,
bool  useCache = true,
std::function< void(TBranch const &)>  baFunc = [](TBranch const&){} 
)

Definition at line 111 of file Event.cc.

References auxBranch_, branchMap_, edm::BranchTypeToAuxBranchName(), edm::BranchTypeToAuxiliaryBranchName(), eventHistoryTree_, edm::poolNames::eventHistoryTreeName(), edm::poolNames::eventTreeName(), Exception, fileVersion_, fwlite::BranchMapReader::getEventTree(), fwlite::BranchMapReader::getFileVersion(), edm::InEvent, pAux_, pOldAux_, runFactory_, and fwlite::BranchMapReader::updateEvent().

111  :
112  file_(iFile),
113 // eventTree_(nullptr),
114  eventHistoryTree_(nullptr),
115 // eventIndex_(-1),
116  branchMap_(iFile),
117  pAux_(&aux_),
118  pOldAux_(nullptr),
119  fileVersion_(-1),
122  std::make_shared<EventHistoryGetter>(this),
123  std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
124  std::make_shared<internal::ProductGetter>(this),
125  useCache, baFunc) {
126  if(nullptr == iFile) {
127  throw cms::Exception("NoFile") << "The TFile pointer passed to the constructor was null";
128  }
129 
130  if(nullptr == branchMap_.getEventTree()) {
131  throw cms::Exception("NoEventTree") << "The TFile contains no TTree named " << edm::poolNames::eventTreeName();
132  }
133  //need to know file version in order to determine how to read the basic event info
135 
136  //got this logic from IOPool/Input/src/RootFile.cc
137 
138  TTree* eventTree = branchMap_.getEventTree();
139  if(fileVersion_ >= 3) {
140  auxBranch_ = eventTree->GetBranch(edm::BranchTypeToAuxiliaryBranchName(edm::InEvent).c_str());
141  if(nullptr == auxBranch_) {
142  throw cms::Exception("NoEventAuxilliary") << "The TTree "
144  << " does not contain a branch named 'EventAuxiliary'";
145  }
146  auxBranch_->SetAddress(&pAux_);
147  } else {
148  pOldAux_ = new edm::EventAux();
149  auxBranch_ = eventTree->GetBranch(edm::BranchTypeToAuxBranchName(edm::InEvent).c_str());
150  if(nullptr == auxBranch_) {
151  throw cms::Exception("NoEventAux") << "The TTree "
153  << " does not contain a branch named 'EventAux'";
154  }
155  auxBranch_->SetAddress(&pOldAux_);
156  }
158 
159  if(fileVersion_ >= 7 && fileVersion_ < 17) {
160  eventHistoryTree_ = dynamic_cast<TTree*>(iFile->Get(edm::poolNames::eventHistoryTreeName().c_str()));
161  }
162  runFactory_ = std::make_shared<RunFactory>();
163 
164 }
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:115
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
bool updateEvent(Long_t eventEntry)
TTree * eventHistoryTree_
Definition: Event.h:191
int fileVersion_
Definition: Event.h:207
int getFileVersion(TFile *file)
bool parameterSetRegistryFilled_
Definition: Event.h:208
edm::EventAuxiliary const * pAux_
Definition: Event.h:204
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
TFile * file_
Definition: Event.h:189
edm::EventAuxiliary aux_
Definition: Event.h:202
std::string const & eventTreeName()
Definition: BranchType.cc:260
std::string const & BranchTypeToAuxBranchName(BranchType const &branchType)
Definition: BranchType.cc:119
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:268
TBranch * auxBranch_
Definition: Event.h:206
edm::EventAux const * pOldAux_
Definition: Event.h:205
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:211
Event::~Event ( )
override

Definition at line 171 of file Event.cc.

References diffTwoXMLs::label, labels_, and pOldAux_.

171  {
172  for(auto const& label : labels_) {
173  delete [] label;
174  }
175  delete pOldAux_;
176 }
std::vector< char const * > labels_
Definition: Event.h:198
edm::EventAux const * pOldAux_
Definition: Event.h:205
fwlite::Event::Event ( Event const &  )
privatedelete

Member Function Documentation

bool Event::atEnd ( ) const
overridevirtual

Implements fwlite::EventBase.

Definition at line 283 of file Event.cc.

References branchMap_, fwlite::BranchMapReader::getEventEntry(), or, and size().

Referenced by FWHLTTriggerTableView::fillAverageAcceptFractions(), FWFileEntry::filterEventsWithCustomParser(), getByLabel(), and main().

283  {
284  Long_t eventIndex = branchMap_.getEventEntry();
285  return eventIndex == -1 or eventIndex == size();
286 }
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:267
Long_t getEventEntry() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
void Event::draw ( Option_t *  opt)

Properly setup for edm::Ref, etc and then call TTree method.

Definition at line 248 of file Event.cc.

References branchMap_, dataHelper_, fwlite::BranchMapReader::getEventTree(), and fwlite::DataGetterHelper::getter().

Referenced by Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

248  {
249  GetterOperate op(dataHelper_.getter());
250  branchMap_.getEventTree()->Draw(opt);
251 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::EDProductGetter const * getter() const
Long64_t Event::draw ( char const *  varexp,
const TCut &  selection,
Option_t *  option = "",
Long64_t  nentries = 1000000000,
Long64_t  firstentry = 0 
)

Definition at line 252 of file Event.cc.

References branchMap_, dataHelper_, fwlite::BranchMapReader::getEventTree(), and fwlite::DataGetterHelper::getter().

Referenced by Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

252  {
253  GetterOperate op(dataHelper_.getter());
254  return branchMap_.getEventTree()->Draw(varexp,selection,option,nentries,firstentry);
255 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
selection
main part
Definition: corrVsCorr.py:98
bool firstentry
Definition: mps_merge.py:75
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::EDProductGetter const * getter() const
Long64_t Event::draw ( char const *  varexp,
char const *  selection,
Option_t *  option = "",
Long64_t  nentries = 1000000000,
Long64_t  firstentry = 0 
)

Definition at line 256 of file Event.cc.

References branchMap_, dataHelper_, fwlite::BranchMapReader::getEventTree(), and fwlite::DataGetterHelper::getter().

Referenced by Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

256  {
257  GetterOperate op(dataHelper_.getter());
258  return branchMap_.getEventTree()->Draw(varexp,selection,option,nentries,firstentry);
259 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
selection
main part
Definition: corrVsCorr.py:98
bool firstentry
Definition: mps_merge.py:75
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::EDProductGetter const * getter() const
edm::EventAuxiliary const & Event::eventAuxiliary ( ) const
overridevirtual

Implements edm::EventBase.

Definition at line 323 of file Event.cc.

References aux_, branchMap_, fwlite::BranchMapReader::getEventEntry(), and updateAux().

Referenced by getLuminosityBlock(), and getRun().

323  {
324  Long_t eventIndex = branchMap_.getEventEntry();
325  updateAux(eventIndex);
326  return aux_;
327 }
Long_t getEventEntry() const
void updateAux(Long_t eventIndex) const
Definition: Event.cc:330
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::EventAuxiliary aux_
Definition: Event.h:202
void Event::fillParameterSetRegistry ( ) const
private

Definition at line 441 of file Event.cc.

References b, branchMap_, Exception, edm::poolNames::fileFormatVersionBranchName(), fwlite::BranchMapReader::getFile(), mps_fire::i, edm::poolNames::idToParameterSetBlobsBranchName(), edm::pset::Registry::insertMapped(), edm::pset::Registry::instance(), edm::poolNames::metaDataTreeName(), edm::poolNames::parameterSetMapBranchName(), parameterSetRegistryFilled_, edm::FileFormatVersion::parameterSetsByReference(), edm::poolNames::parameterSetsTreeName(), muonDTDigis_cfi::pset, and edm::FileFormatVersion::triggerPathsTracked().

Referenced by parameterSet(), triggerNames(), and triggerResultsByName().

441  {
442  if (parameterSetRegistryFilled_) return;
444 
445  TTree* meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
446  if (nullptr == meta) {
447  throw cms::Exception("NoMetaTree") << "The TFile does not contain a TTree named "
449  }
450 
451  edm::FileFormatVersion fileFormatVersion;
452  edm::FileFormatVersion *fftPtr = &fileFormatVersion;
453  if(meta->FindBranch(edm::poolNames::fileFormatVersionBranchName().c_str()) != nullptr) {
454  TBranch *fft = meta->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str());
455  fft->SetAddress(&fftPtr);
456  fft->GetEntry(0);
457  }
458 
459  typedef std::map<edm::ParameterSetID, edm::ParameterSetBlob> PsetMap;
460  PsetMap psetMap;
461  TTree* psetTree(nullptr);
462  if (meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != nullptr) {
463  PsetMap *psetMapPtr = &psetMap;
464  TBranch* b = meta->GetBranch(edm::poolNames::parameterSetMapBranchName().c_str());
465  b->SetAddress(&psetMapPtr);
466  b->GetEntry(0);
467  } else if(nullptr == (psetTree = dynamic_cast<TTree *>(branchMap_.getFile()->Get(edm::poolNames::parameterSetsTreeName().c_str())))) {
468  throw cms::Exception("NoParameterSetMapTree")
469  << "The TTree "
470  << edm::poolNames::parameterSetsTreeName() << " could not be found in the file.";
471  } else {
472  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
473  IdToBlobs idToBlob;
474  IdToBlobs* pIdToBlob = &idToBlob;
475  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
476  for(long long i = 0; i != psetTree->GetEntries(); ++i) {
477  psetTree->GetEntry(i);
478  psetMap.insert(idToBlob);
479  }
480  }
482  if(!fileFormatVersion.triggerPathsTracked()) {
483  edm::ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion.parameterSetsByReference());
484  } else {
485  // Merge into the parameter set registry.
487  for(auto const& item : psetMap) {
488  edm::ParameterSet pset(item.second.pset());
489  pset.setID(item.first);
490  psetRegistry.insertMapped(pset);
491  }
492  }
493 }
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:255
TFile const * getFile() const
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:218
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:251
bool parameterSetRegistryFilled_
Definition: Event.h:208
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:36
std::string const & metaDataTreeName()
Definition: BranchType.cc:168
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:183
bool triggerPathsTracked() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
bool parameterSetsByReference() const
double b
Definition: hdecay.h:120
static Registry * instance()
Definition: Registry.cc:13
std::vector<edm::BranchDescription> const& fwlite::Event::getBranchDescriptions ( ) const
inline

Definition at line 145 of file Event.h.

Referenced by FWLiteJobMetadataManager::doUpdate(), and FWLiteJobMetadataManager::hasModuleLabel().

145  {
147  }
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
const std::vector< edm::BranchDescription > & getBranchDescriptions()
std::string const Event::getBranchNameFor ( std::type_info const &  iInfo,
char const *  iModuleLabel,
char const *  iProductInstanceLabel,
char const *  iProcessName 
) const
overridevirtual

Return the branch name in the TFile which contains the data.

Implements fwlite::EventBase.

Definition at line 301 of file Event.cc.

References dataHelper_, and fwlite::DataGetterHelper::getBranchNameFor().

Referenced by FWFileEntry::getBranchName(), and FWFileEntry::runFilter().

304  {
305  return dataHelper_.getBranchNameFor(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel);
306 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
virtual std::string const getBranchNameFor(std::type_info const &, char const *, char const *, char const *) const
bool Event::getByLabel ( std::type_info const &  iInfo,
char const *  iModuleLabel,
char const *  iProductInstanceLabel,
char const *  iProcessLabel,
void *  oData 
) const
overridevirtual

This function should only be called by fwlite::Handle<>

Implements fwlite::EventBase.

Definition at line 309 of file Event.cc.

References atEnd(), branchMap_, dataHelper_, Exception, fwlite::DataGetterHelper::getByLabel(), and fwlite::BranchMapReader::getEventEntry().

314  {
315  if(atEnd()) {
316  throw cms::Exception("OffEnd") << "You have requested data past the last event";
317  }
318  Long_t eventIndex = branchMap_.getEventEntry();
319  return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, oData, eventIndex);
320 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
Long_t getEventEntry() const
bool atEnd() const override
Definition: Event.cc:283
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *, Long_t) const
edm::WrapperBase const * Event::getByProductID ( edm::ProductID const &  iID) const
overridevirtual

Implements fwlite::EventBase.

Definition at line 405 of file Event.cc.

References branchMap_, dataHelper_, fwlite::DataGetterHelper::getByProductID(), and fwlite::BranchMapReader::getEventEntry().

405  {
406  Long_t eventEntry = branchMap_.getEventEntry();
407  return dataHelper_.getByProductID(iID, eventEntry);
408 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
Long_t getEventEntry() const
edm::WrapperBase const * getByProductID(edm::ProductID const &pid, Long_t eventEntry) const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
fwlite::LuminosityBlock const & Event::getLuminosityBlock ( ) const

Definition at line 527 of file Event.cc.

References branchMap_, eventAuxiliary(), lumi_, edm::EventAuxiliary::luminosityBlock(), edm::EventAuxiliary::run(), findQualityFiles::run, and runFactory_.

Referenced by main().

527  {
528  if (not lumi_) {
529  // Branch map pointer not really being shared, owned by event, have to trick Lumi
530  lumi_ = std::make_shared<fwlite::LuminosityBlock> (std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
531  runFactory_);
532  }
535  lumi_->to(run, lumi);
536  return *lumi_;
537 }
RunNumber_t run() const
unsigned int LuminosityBlockNumber_t
edm::EventAuxiliary const & eventAuxiliary() const override
Definition: Event.cc:323
LuminosityBlockNumber_t luminosityBlock() const
std::shared_ptr< fwlite::LuminosityBlock > lumi_
Definition: Event.h:193
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
unsigned int RunNumber_t
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:211
std::vector< std::string > const & Event::getProcessHistory ( ) const

Definition at line 290 of file Event.cc.

References history(), proc, procHistoryNames_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FWLiteJobMetadataManager::doUpdate().

290  {
291  if (procHistoryNames_.empty()) {
292  for (auto const& proc : history()) {
293  procHistoryNames_.push_back(proc.processName());
294  }
295  }
296  return procHistoryNames_;
297 }
TrainProcessor *const proc
Definition: MVATrainer.cc:101
std::vector< std::string > procHistoryNames_
Definition: Event.h:201
edm::ProcessHistory const & history() const
Definition: Event.cc:341
fwlite::Run const & Event::getRun ( ) const

Definition at line 539 of file Event.cc.

References branchMap_, eventAuxiliary(), edm::EventAuxiliary::run(), findQualityFiles::run, run_, and runFactory_.

Referenced by FWMagField::checkFieldInfo(), FWL1TriggerTableView::fillTable(), and main().

539  {
540  run_ = runFactory_->makeRun(std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()));
542  run_->to(run);
543  return *run_;
544 }
RunNumber_t run() const
std::shared_ptr< fwlite::Run > run_
Definition: Event.h:194
edm::EventAuxiliary const & eventAuxiliary() const override
Definition: Event.cc:323
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
unsigned int RunNumber_t
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:211
TFile* fwlite::Event::getTFile ( ) const
inline

Definition at line 149 of file Event.h.

References edm::getThinnedProduct(), crabWrapper::key, relativeConstraints::keys, edm::parameterSet(), sysUtil::pid, and edm::triggerResults().

149  {
150  return branchMap_.getFile();
151  }
TFile const * getFile() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::WrapperBase const * Event::getThinnedProduct ( edm::ProductID const &  pid,
unsigned int &  key 
) const

Definition at line 411 of file Event.cc.

References branchMap_, dataHelper_, fwlite::BranchMapReader::getEventEntry(), and fwlite::DataGetterHelper::getThinnedProduct().

411  {
412  Long_t eventEntry = branchMap_.getEventEntry();
413  return dataHelper_.getThinnedProduct(pid, key, eventEntry);
414 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::WrapperBase const * getThinnedProduct(edm::ProductID const &pid, unsigned int &key, Long_t eventEntry) const
void Event::getThinnedProducts ( edm::ProductID const &  pid,
std::vector< edm::WrapperBase const * > &  foundContainers,
std::vector< unsigned int > &  keys 
) const

Definition at line 417 of file Event.cc.

References branchMap_, dataHelper_, fwlite::BranchMapReader::getEventEntry(), and fwlite::DataGetterHelper::getThinnedProducts().

419  {
420  Long_t eventEntry = branchMap_.getEventEntry();
421  return dataHelper_.getThinnedProducts(pid, foundContainers, keys, eventEntry);
422 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
void getThinnedProducts(edm::ProductID const &pid, std::vector< edm::WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys, Long_t eventEntry) const
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
const edm::ProcessHistory & Event::history ( ) const
private

Definition at line 341 of file Event.cc.

References aux_, b, branchMap_, edm::poolNames::eventHistoryBranchName(), eventHistoryTree_, eventProcessHistoryIDs_, Exception, edm::errors::FatalRootError, fileVersion_, fwlite::BranchMapReader::getEventEntry(), fwlite::BranchMapReader::getFile(), historyMap_, edm::EventAuxiliary::id(), edm::poolNames::metaDataTreeName(), edm::poolNames::processHistoryBranchName(), edm::History::processHistoryID(), edm::EventAuxiliary::processHistoryID(), edm::poolNames::processHistoryMapBranchName(), procHistoryNames_, edm::ProcessHistory::setProcessHistoryID(), edmPickEvents::target, and updateAux().

Referenced by getProcessHistory(), and fwlite::EventHistoryGetter::history().

341  {
342  edm::ProcessHistoryID processHistoryID;
343 
344  bool newFormat = (fileVersion_ >= 5);
345 
346  Long_t eventIndex = branchMap_.getEventEntry();
347  updateAux(eventIndex);
348  if (!newFormat) {
349  processHistoryID = aux_.processHistoryID();
350  }
351  if(historyMap_.empty() || newFormat) {
352  procHistoryNames_.clear();
353  TTree *meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
354  if(nullptr == meta) {
355  throw cms::Exception("NoMetaTree") << "The TFile does not appear to contain a TTree named "
357  }
358  if (historyMap_.empty()) {
359  if (fileVersion_ < 11) {
361  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryMapBranchName().c_str());
362  b->SetAddress(&pPhm);
363  b->GetEntry(0);
364  } else {
365  edm::ProcessHistoryVector historyVector;
366  edm::ProcessHistoryVector* pPhv = &historyVector;
367  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryBranchName().c_str());
368  b->SetAddress(&pPhv);
369  b->GetEntry(0);
370  for (auto& history : historyVector) {
371  historyMap_.insert(std::make_pair(history.setProcessHistoryID(), history));
372  }
373  }
374  }
375  if (newFormat) {
376  if (fileVersion_ >= 17) {
377  processHistoryID = aux_.processHistoryID();
378  } else if (fileVersion_ >= 7) {
380  edm::History* pHistory = &history;
381  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
382  if (!eventHistoryBranch)
384  << "Failed to find history branch in event history tree";
385  eventHistoryBranch->SetAddress(&pHistory);
386  eventHistoryTree_->GetEntry(eventIndex);
387  processHistoryID = history.processHistoryID();
388  } else {
389  std::vector<edm::EventProcessHistoryID> *pEventProcessHistoryIDs = &eventProcessHistoryIDs_;
390  TBranch* b = meta->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
391  b->SetAddress(&pEventProcessHistoryIDs);
392  b->GetEntry(0);
394  processHistoryID = std::lower_bound(eventProcessHistoryIDs_.begin(), eventProcessHistoryIDs_.end(), target)->processHistoryID();
395  }
396  }
397 
398  }
399 
400  return historyMap_[processHistoryID];
401 }
std::vector< ProcessHistory > ProcessHistoryVector
edm::ProcessHistoryMap historyMap_
Definition: Event.h:199
TFile const * getFile() const
ProcessHistoryID setProcessHistoryID()
TTree * eventHistoryTree_
Definition: Event.h:191
int fileVersion_
Definition: Event.h:207
Long_t getEventEntry() const
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:193
std::vector< std::string > procHistoryNames_
Definition: Event.h:201
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:238
ProcessHistoryID const & processHistoryID() const
Definition: History.h:46
void updateAux(Long_t eventIndex) const
Definition: Event.cc:330
std::string const & metaDataTreeName()
Definition: BranchType.cc:168
Hash< ProcessHistoryType > ProcessHistoryID
std::string const & processHistoryBranchName()
Definition: BranchType.cc:198
edm::ProcessHistory const & history() const
Definition: Event.cc:341
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
double b
Definition: hdecay.h:120
edm::EventAuxiliary aux_
Definition: Event.h:202
std::vector< edm::EventProcessHistoryID > eventProcessHistoryIDs_
Definition: Event.h:200
ProcessHistoryID const & processHistoryID() const
EventID const & id() const
std::map< ProcessHistoryID, ProcessHistory > ProcessHistoryMap
Long64_t Event::indexFromEventId ( edm::RunNumber_t  run,
edm::LuminosityBlockNumber_t  lumi,
edm::EventNumber_t  event 
)

Find index of given event-id.

Definition at line 203 of file Event.cc.

References branchMap_, mps_splice::entry, entryFinder_, fwlite::EntryFinder::fillIndex(), fwlite::EntryFinder::findEvent(), and fwlite::EntryFinder::invalidEntry.

203  {
206  return (entry == EntryFinder::invalidEntry) ? -1 : entry;
207 }
EntryNumber_t findEvent(edm::RunNumber_t const &run, edm::LuminosityBlockNumber_t const &lumi, edm::EventNumber_t const &event) const
Definition: EntryFinder.cc:57
edm::IndexIntoFile::EntryNumber_t EntryNumber_t
Definition: EntryFinder.h:33
void fillIndex(BranchMapReader &branchMap)
Definition: EntryFinder.cc:108
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:39
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
EntryFinder entryFinder_
Definition: Event.h:203
Definition: event.py:1
bool Event::isValid ( void  ) const

Definition at line 272 of file Event.cc.

References branchMap_, fwlite::BranchMapReader::getEventEntry(), and size().

Referenced by ntupleDataFormat._Object::_checkIsValid(), operator bool(), and core.AutoHandle.AutoHandle::ReallyLoad().

272  {
273  Long_t eventIndex = branchMap_.getEventEntry();
274  return eventIndex != -1 and eventIndex < size();
275 }
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:267
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
Event::operator bool ( ) const

Definition at line 278 of file Event.cc.

References isValid().

278  {
279  return isValid();
280 }
bool isValid() const
Definition: Event.cc:272
Event const & Event::operator++ ( )
overridevirtual

Advance to next event in the TFile.

Implements fwlite::EventBase.

Definition at line 194 of file Event.cc.

References branchMap_, fwlite::BranchMapReader::getEventEntry(), size(), and fwlite::BranchMapReader::updateEvent().

194  {
195  Long_t eventIndex = branchMap_.getEventEntry();
196  if(eventIndex < size()) {
197  branchMap_.updateEvent(++eventIndex);
198  }
199  return *this;
200 }
bool updateEvent(Long_t eventEntry)
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:267
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
Event const& fwlite::Event::operator= ( Event const &  )
privatedelete
edm::ParameterSet const * Event::parameterSet ( edm::ParameterSetID const &  psID) const
overridevirtual

Implements edm::EventBase.

Definition at line 496 of file Event.cc.

References fillParameterSetRegistry(), edm::EventBase::parameterSetForID_(), and parameterSetRegistryFilled_.

496  {
499  }
500  return parameterSetForID_(psID);
501 }
static edm::ParameterSet const * parameterSetForID_(edm::ParameterSetID const &psID)
Definition: EventBase.cc:49
bool parameterSetRegistryFilled_
Definition: Event.h:208
void fillParameterSetRegistry() const
Definition: Event.cc:441
edm::ProcessHistory const& fwlite::Event::processHistory ( ) const
inlineoverridevirtual

Implements edm::EventBase.

Definition at line 165 of file Event.h.

References edm::throwProductNotFoundException().

165 {return history();}
edm::ProcessHistory const & history() const
Definition: Event.cc:341
Long64_t Event::scan ( char const *  varexp = "",
char const *  selection = "",
Option_t *  option = "",
Long64_t  nentries = 1000000000,
Long64_t  firstentry = 0 
)

Definition at line 260 of file Event.cc.

References branchMap_, dataHelper_, fwlite::BranchMapReader::getEventTree(), and fwlite::DataGetterHelper::getter().

260  {
261  GetterOperate op(dataHelper_.getter());
262  return branchMap_.getEventTree()->Scan(varexp,selection,option,nentries,firstentry);
263 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
selection
main part
Definition: corrVsCorr.py:98
bool firstentry
Definition: mps_merge.py:75
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::EDProductGetter const * getter() const
void fwlite::Event::setGetter ( std::shared_ptr< edm::EDProductGetter const >  getter)
inlineprivate

Definition at line 186 of file Event.h.

186 { return dataHelper_.setGetter(getter);}
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:210
void setGetter(std::shared_ptr< edm::EDProductGetter const > getter)
Long64_t Event::size ( void  ) const

Returns number of events in the file.

Definition at line 267 of file Event.cc.

References branchMap_, and fwlite::BranchMapReader::getEventTree().

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), atEnd(), FWHLTTriggerTableView::fillAverageAcceptFractions(), isValid(), FWFileEntry::openFile(), operator++(), and to().

267  {
268  return branchMap_.getEventTree()->GetEntries();
269 }
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
void Event::throwProductNotFoundException ( std::type_info const &  iType,
char const *  iModule,
char const *  iProduct,
char const *  iProcess 
)
static

Definition at line 519 of file Event.cc.

References edm::TypeID::className(), Exception, and edm::errors::ProductNotFound.

Referenced by fwlite::ChainEvent::throwProductNotFoundException().

519  {
520  edm::TypeID type(iType);
521  throw edm::Exception(edm::errors::ProductNotFound) << "A branch was found for \n type ='" << type.className() << "'\n module='" << iModule
522  << "'\n productInstance='" << ((nullptr != iProduct)?iProduct:"") << "'\n process='" << ((nullptr != iProcess) ? iProcess : "") << "'\n"
523  "but no data is available for this Event";
524 }
type
Definition: HCALResponse.h:21
bool Event::to ( Long64_t  iIndex)

Go to the event at index iIndex.

Definition at line 210 of file Event.cc.

References branchMap_, size(), and fwlite::BranchMapReader::updateEvent().

Referenced by FWHLTTriggerTableView::fillAverageAcceptFractions(), FWFileEntry::filterEventsWithCustomParser(), and to().

210  {
211  if (iEntry < size()) {
212  // this is a valid entry
213  return branchMap_.updateEvent(iEntry);
214  }
215  // if we're here, then iEntry was not valid
216  return false;
217 }
bool updateEvent(Long_t eventEntry)
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:267
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
bool Event::to ( const edm::EventID id)

Go to event by Run & Event number.

Definition at line 235 of file Event.cc.

References event(), edm::EventBase::luminosityBlock(), findQualityFiles::run, and to().

235  {
236  return to(id.run(), id.luminosityBlock(), id.event());
237 }
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: Event.cc:210
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool Event::to ( edm::RunNumber_t  run,
edm::EventNumber_t  event 
)

Definition at line 220 of file Event.cc.

References to(), and mitigatedMETSequence_cff::U.

220  {
221  return to(run, 0U, event);
222 }
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: Event.cc:210
Definition: event.py:1
bool Event::to ( edm::RunNumber_t  run,
edm::LuminosityBlockNumber_t  lumi,
edm::EventNumber_t  event 
)

Definition at line 225 of file Event.cc.

References branchMap_, mps_splice::entry, entryFinder_, fwlite::EntryFinder::fillIndex(), fwlite::EntryFinder::findEvent(), fwlite::EntryFinder::invalidEntry, and fwlite::BranchMapReader::updateEvent().

225  {
228  if (entry == EntryFinder::invalidEntry) {
229  return false;
230  }
231  return branchMap_.updateEvent(entry);
232 }
bool updateEvent(Long_t eventEntry)
EntryNumber_t findEvent(edm::RunNumber_t const &run, edm::LuminosityBlockNumber_t const &lumi, edm::EventNumber_t const &event) const
Definition: EntryFinder.cc:57
edm::IndexIntoFile::EntryNumber_t EntryNumber_t
Definition: EntryFinder.h:33
void fillIndex(BranchMapReader &branchMap)
Definition: EntryFinder.cc:108
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:39
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
EntryFinder entryFinder_
Definition: Event.h:203
Definition: event.py:1
Event const & Event::toBegin ( )
overridevirtual

Go to the very first Event.

Implements fwlite::EventBase.

Definition at line 240 of file Event.cc.

References branchMap_, and fwlite::BranchMapReader::updateEvent().

Referenced by FWHLTTriggerTableView::fillAverageAcceptFractions(), FWFileEntry::filterEventsWithCustomParser(), and main().

240  {
242  return *this;
243 }
bool updateEvent(Long_t eventEntry)
fwlite::BranchMapReader branchMap_
Definition: Event.h:195
edm::TriggerNames const & Event::triggerNames ( edm::TriggerResults const &  triggerResults) const
overridevirtual

Implements edm::EventBase.

Definition at line 425 of file Event.cc.

References Exception, fillParameterSetRegistry(), cscdqm::h::names, parameterSetRegistryFilled_, and edm::EventBase::triggerNames_().

Referenced by FWHLTTriggerTableView::fillAverageAcceptFractions(), and FWFileEntry::filterEventsWithCustomParser().

425  {
427  if (names != nullptr) return *names;
428 
431  names = triggerNames_(triggerResults);
432  }
433  if (names != nullptr) return *names;
434 
435  throw cms::Exception("TriggerNamesNotFound")
436  << "TriggerNames not found in ParameterSet registry";
437  return *names;
438 }
static const HistoName names[]
bool parameterSetRegistryFilled_
Definition: Event.h:208
static std::string const triggerResults
Definition: EdmProvDump.cc:41
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:54
void fillParameterSetRegistry() const
Definition: Event.cc:441
edm::TriggerResultsByName Event::triggerResultsByName ( edm::TriggerResults const &  triggerResults) const
overridevirtual

Implements edm::EventBase.

Definition at line 505 of file Event.cc.

References fillParameterSetRegistry(), cscdqm::h::names, parameterSetRegistryFilled_, and edm::EventBase::triggerNames_().

505  {
506 
508  if (names == nullptr && !parameterSetRegistryFilled_) {
510  names = triggerNames_(triggerResults);
511  }
513 }
static const HistoName names[]
bool parameterSetRegistryFilled_
Definition: Event.h:208
static std::string const triggerResults
Definition: EdmProvDump.cc:41
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:54
void fillParameterSetRegistry() const
Definition: Event.cc:441
void Event::updateAux ( Long_t  eventIndex) const
private

Definition at line 330 of file Event.cc.

References aux_, auxBranch_, edm::conversion(), and pOldAux_.

Referenced by eventAuxiliary(), and history().

330  {
331  if(auxBranch_->GetEntryNumber() != eventIndex) {
332  auxBranch_->GetEntry(eventIndex);
333  //handling dealing with old version
334  if(nullptr != pOldAux_) {
336  }
337  }
338 }
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
edm::EventAuxiliary aux_
Definition: Event.h:202
TBranch * auxBranch_
Definition: Event.h:206
edm::EventAux const * pOldAux_
Definition: Event.h:205

Friends And Related Function Documentation

friend class ChainEvent
friend

Definition at line 176 of file Event.h.

friend class EventHistoryGetter
friend

Definition at line 177 of file Event.h.

friend class internal::ProductGetter
friend

Definition at line 175 of file Event.h.

Member Data Documentation

edm::EventAuxiliary fwlite::Event::aux_
mutableprivate

Definition at line 202 of file Event.h.

Referenced by eventAuxiliary(), history(), and updateAux().

TBranch* fwlite::Event::auxBranch_
private

Definition at line 206 of file Event.h.

Referenced by Event(), and updateAux().

fwlite::BranchMapReader fwlite::Event::branchMap_
mutableprivate
fwlite::DataGetterHelper fwlite::Event::dataHelper_
private
EntryFinder fwlite::Event::entryFinder_
mutableprivate

Definition at line 203 of file Event.h.

Referenced by indexFromEventId(), and to().

TTree* fwlite::Event::eventHistoryTree_
private

Definition at line 191 of file Event.h.

Referenced by Event(), and history().

std::vector<edm::EventProcessHistoryID> fwlite::Event::eventProcessHistoryIDs_
mutableprivate

Definition at line 200 of file Event.h.

Referenced by history().

TFile* fwlite::Event::file_
mutableprivate

Definition at line 189 of file Event.h.

int fwlite::Event::fileVersion_
private

Definition at line 207 of file Event.h.

Referenced by Event(), and history().

edm::ProcessHistoryMap fwlite::Event::historyMap_
mutableprivate

Definition at line 199 of file Event.h.

Referenced by history().

std::vector<char const*> fwlite::Event::labels_
mutableprivate

Definition at line 198 of file Event.h.

Referenced by ~Event().

std::shared_ptr<fwlite::LuminosityBlock> fwlite::Event::lumi_
mutableprivate

Definition at line 193 of file Event.h.

Referenced by getLuminosityBlock().

bool fwlite::Event::parameterSetRegistryFilled_
mutableprivate
edm::EventAuxiliary const* fwlite::Event::pAux_
private

Definition at line 204 of file Event.h.

Referenced by Event().

edm::EventAux const* fwlite::Event::pOldAux_
private

Definition at line 205 of file Event.h.

Referenced by Event(), updateAux(), and ~Event().

std::vector<std::string> fwlite::Event::procHistoryNames_
mutableprivate

Definition at line 201 of file Event.h.

Referenced by getProcessHistory(), and history().

std::shared_ptr<fwlite::Run> fwlite::Event::run_
mutableprivate

Definition at line 194 of file Event.h.

Referenced by getRun().

std::shared_ptr<RunFactory> fwlite::Event::runFactory_
mutableprivate

Definition at line 211 of file Event.h.

Referenced by Event(), getLuminosityBlock(), and getRun().