CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual bool atEnd () const
 
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)
 
virtual edm::EventAuxiliary const & eventAuxiliary () const
 
std::vector
< edm::BranchDescription >
const & 
getBranchDescriptions () const
 
virtual std::string const getBranchNameFor (std::type_info const &, char const *iModuleLabel, char const *iProductInstanceLabel, char const *iProcessName) const
 Return the branch name in the TFile which contains the data. More...
 
virtual bool getByLabel (std::type_info const &, char const *, char const *, char const *, void *) const
 This function should only be called by fwlite::Handle<> More...
 
virtual edm::WrapperBase const * getByProductID (edm::ProductID const &) const
 
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++ ()
 Advance to next event in the TFile. More...
 
virtual edm::ProcessHistory const & processHistory () const
 
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 ()
 Go to the very first Event. More...
 
virtual edm::TriggerNames const & triggerNames (edm::TriggerResults const &triggerResults) const
 
virtual edm::TriggerResultsByName triggerResultsByName (std::string const &process) const
 
virtual ~Event ()
 
- Public Member Functions inherited from fwlite::EventBase
 EventBase ()
 
virtual Long64_t fileIndex () const
 
virtual Long64_t secondaryFileIndex () const
 
virtual ~EventBase ()
 
- 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 &)
 
void fillParameterSetRegistry () const
 
edm::ProcessHistory const & history () const
 
Event const & operator= (Event const &)
 
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::EventProcessHistoryID
eventProcessHistoryIDs_
 
TFile * file_
 
int fileVersion_
 
edm::ProcessHistoryMap historyMap_
 
std::vector< char const * > labels_
 
std::shared_ptr
< fwlite::LuminosityBlock
lumi_
 
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 TriggerNames const * triggerNames_ (edm::TriggerResults const &triggerResults)
 

Detailed Description

Definition at line 84 of file Event.h.

Constructor & Destructor Documentation

Event::Event ( TFile *  iFile)

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  true) {
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:200
bool updateEvent(Long_t eventEntry)
TTree * eventHistoryTree_
Definition: Event.h:181
int fileVersion_
Definition: Event.h:197
int getFileVersion(TFile *file)
bool parameterSetRegistryFilled_
Definition: Event.h:198
edm::EventAuxiliary const * pAux_
Definition: Event.h:194
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
TFile * file_
Definition: Event.h:179
edm::EventAuxiliary aux_
Definition: Event.h:192
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:196
edm::EventAux const * pOldAux_
Definition: Event.h:195
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:201
Event::~Event ( )
virtual

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:188
edm::EventAux const * pOldAux_
Definition: Event.h:195
fwlite::Event::Event ( Event const &  )
private

Member Function Documentation

bool Event::atEnd ( ) const
virtual

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 }
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
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:185
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:200
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
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:200
selection
main part
Definition: corrVsCorr.py:98
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
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:200
selection
main part
Definition: corrVsCorr.py:98
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
edm::EDProductGetter const * getter() const
edm::EventAuxiliary const & Event::eventAuxiliary ( ) const
virtual

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:185
edm::EventAuxiliary aux_
Definition: Event.h:192
void Event::fillParameterSetRegistry ( ) const
private

Definition at line 441 of file Event.cc.

References b, branchMap_, Exception, edm::poolNames::fileFormatVersionBranchName(), fwlite::BranchMapReader::getFile(), 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(), TrackValidation_cff::pset, and edm::FileFormatVersion::triggerPathsTracked().

Referenced by 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()) != 0) {
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()) != 0) {
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
int i
Definition: DBlmapReader.cc:9
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:198
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
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:185
bool parameterSetsByReference() const
double b
Definition: hdecay.h:120
bool insertMapped(value_type const &v)
Definition: Registry.cc:35
static Registry * instance()
Definition: Registry.cc:12
std::vector<edm::BranchDescription> const& fwlite::Event::getBranchDescriptions ( ) const
inline

Definition at line 137 of file Event.h.

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

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

137  {
139  }
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
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
virtual

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

304  {
305  return dataHelper_.getBranchNameFor(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel);
306 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:200
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
virtual

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:200
Long_t getEventEntry() const
virtual bool atEnd() const
Definition: Event.cc:283
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
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
virtual

Implements fwlite::EventBase.

Definition at line 405 of file Event.cc.

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

Referenced by fwlite::internal::ProductGetter::getIt().

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

Definition at line 524 of file Event.cc.

References branchMap_, eventAuxiliary(), fjr2json::lumi, lumi_, edm::EventAuxiliary::luminosityBlock(), DTTTrigCorrFirst::run, edm::EventAuxiliary::run(), and runFactory_.

Referenced by main().

524  {
525  if (not lumi_) {
526  // Branch map pointer not really being shared, owned by event, have to trick Lumi
527  lumi_ = std::shared_ptr<fwlite::LuminosityBlock> (
528  new fwlite::LuminosityBlock(std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
529  runFactory_)
530  );
531  }
534  lumi_->to(run, lumi);
535  return *lumi_;
536 }
tuple lumi
Definition: fjr2json.py:35
RunNumber_t run() const
unsigned int LuminosityBlockNumber_t
LuminosityBlockNumber_t luminosityBlock() const
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:323
std::shared_ptr< fwlite::LuminosityBlock > lumi_
Definition: Event.h:183
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
unsigned int RunNumber_t
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:201
std::vector< std::string > const & Event::getProcessHistory ( ) const

Definition at line 290 of file Event.cc.

References history(), proc, and procHistoryNames_.

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:191
edm::ProcessHistory const & history() const
Definition: Event.cc:341
fwlite::Run const & Event::getRun ( ) const

Definition at line 538 of file Event.cc.

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

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

538  {
539  run_ = runFactory_->makeRun(std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()));
541  run_->to(run);
542  return *run_;
543 }
RunNumber_t run() const
std::shared_ptr< fwlite::Run > run_
Definition: Event.h:184
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:323
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
unsigned int RunNumber_t
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:201
TFile* fwlite::Event::getTFile ( ) const
inline

Definition at line 141 of file Event.h.

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

141  {
142  return branchMap_.getFile();
143  }
TFile const * getFile() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
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().

Referenced by fwlite::internal::ProductGetter::getThinnedProduct().

411  {
412  Long_t eventEntry = branchMap_.getEventEntry();
413  return dataHelper_.getThinnedProduct(pid, key, eventEntry);
414 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:200
Long_t getEventEntry() const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
tuple pid
Definition: sysUtil.py:22
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().

Referenced by fwlite::internal::ProductGetter::getThinnedProducts().

419  {
420  Long_t eventEntry = branchMap_.getEventEntry();
421  return dataHelper_.getThinnedProducts(pid, foundContainers, keys, eventEntry);
422 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:200
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:185
tuple pid
Definition: sysUtil.py:22
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(), filterCSVwithJSON::target, and updateAux().

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

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:189
TFile const * getFile() const
ProcessHistoryID setProcessHistoryID()
TTree * eventHistoryTree_
Definition: Event.h:181
int fileVersion_
Definition: Event.h:197
Long_t getEventEntry() const
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:193
std::vector< std::string > procHistoryNames_
Definition: Event.h:191
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:185
double b
Definition: hdecay.h:120
edm::EventAuxiliary aux_
Definition: Event.h:192
std::vector< edm::EventProcessHistoryID > eventProcessHistoryIDs_
Definition: Event.h:190
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 }
tuple lumi
Definition: fjr2json.py:35
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
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
void fillIndex(BranchMapReader &branchMap)
Definition: EntryFinder.cc:108
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:39
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
EntryFinder entryFinder_
Definition: Event.h:193
list entry
Definition: mps_splice.py:62
bool Event::isValid ( void  ) const

Definition at line 272 of file Event.cc.

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

Referenced by 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:185
Event::operator bool ( ) const

Definition at line 278 of file Event.cc.

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

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:185
Event const& fwlite::Event::operator= ( Event const &  )
private
virtual edm::ProcessHistory const& fwlite::Event::processHistory ( ) const
inlinevirtual

Implements edm::EventBase.

Definition at line 155 of file Event.h.

References history().

155 {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:200
selection
main part
Definition: corrVsCorr.py:98
TTree const * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
edm::EDProductGetter const * getter() const
void fwlite::Event::setGetter ( std::shared_ptr< edm::EDProductGetter const >  getter)
inlineprivate

Definition at line 176 of file Event.h.

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

176 { return dataHelper_.setGetter(getter);}
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:200
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 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:185
void Event::throwProductNotFoundException ( std::type_info const &  iType,
char const *  iModule,
char const *  iProduct,
char const *  iProcess 
)
static

Definition at line 516 of file Event.cc.

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

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

516  {
517  edm::TypeID type(iType);
518  throw edm::Exception(edm::errors::ProductNotFound) << "A branch was found for \n type ='" << type.className() << "'\n module='" << iModule
519  << "'\n productInstance='" << ((nullptr != iProduct)?iProduct:"") << "'\n process='" << ((nullptr != iProcess) ? iProcess : "") << "'\n"
520  "but no data is available for this Event";
521 }
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:185
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(), DTTTrigCorrFirst::run, and to().

235  {
236  return to(id.run(), id.luminosityBlock(), id.event());
237 }
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:62
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().

220  {
221  return to(run, 0U, event);
222 }
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::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 }
tuple lumi
Definition: fjr2json.py:35
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
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
void fillIndex(BranchMapReader &branchMap)
Definition: EntryFinder.cc:108
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:39
fwlite::BranchMapReader branchMap_
Definition: Event.h:185
EntryFinder entryFinder_
Definition: Event.h:193
list entry
Definition: mps_splice.py:62
Event const & Event::toBegin ( )
virtual

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:185
edm::TriggerNames const & Event::triggerNames ( edm::TriggerResults const &  triggerResults) const
virtual

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:198
static std::string const triggerResults
Definition: EdmProvDump.cc:41
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:48
void fillParameterSetRegistry() const
Definition: Event.cc:441
edm::TriggerResultsByName Event::triggerResultsByName ( std::string const &  process) const
virtual

Implements edm::EventBase.

Definition at line 496 of file Event.cc.

References fillParameterSetRegistry(), fwlite::Handle< T >::getByLabel(), fwlite::Handle< T >::isValid(), cscdqm::h::names, parameterSetRegistryFilled_, fwlite::Handle< T >::product(), and edm::EventBase::triggerNames_().

496  {
497 
498  fwlite::Handle<edm::TriggerResults> hTriggerResults;
499  hTriggerResults.getByLabel(*this, "TriggerResults", "", process.c_str());
500  if (!hTriggerResults.isValid()) {
501  return edm::TriggerResultsByName(0,0);
502  }
503 
504  edm::TriggerNames const* names = triggerNames_(*hTriggerResults);
505  if (names == nullptr && !parameterSetRegistryFilled_) {
507  names = triggerNames_(*hTriggerResults);
508  }
509  return edm::TriggerResultsByName(hTriggerResults.product(), names);
510 }
static const HistoName names[]
bool isValid() const
Definition: Handle.h:61
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:91
bool parameterSetRegistryFilled_
Definition: Event.h:198
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:48
void fillParameterSetRegistry() const
Definition: Event.cc:441
T const * product() const
Definition: Handle.h:66
tuple process
Definition: LaserDQM_cfg.py:3
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:192
TBranch * auxBranch_
Definition: Event.h:196
edm::EventAux const * pOldAux_
Definition: Event.h:195

Friends And Related Function Documentation

friend class ChainEvent
friend

Definition at line 166 of file Event.h.

friend class EventHistoryGetter
friend

Definition at line 167 of file Event.h.

friend class internal::ProductGetter
friend

Definition at line 165 of file Event.h.

Member Data Documentation

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

Definition at line 192 of file Event.h.

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

TBranch* fwlite::Event::auxBranch_
private

Definition at line 196 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 193 of file Event.h.

Referenced by indexFromEventId(), and to().

TTree* fwlite::Event::eventHistoryTree_
private

Definition at line 181 of file Event.h.

Referenced by Event(), and history().

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

Definition at line 190 of file Event.h.

Referenced by history().

TFile* fwlite::Event::file_
mutableprivate

Definition at line 179 of file Event.h.

int fwlite::Event::fileVersion_
private

Definition at line 197 of file Event.h.

Referenced by Event(), and history().

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

Definition at line 189 of file Event.h.

Referenced by history().

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

Definition at line 188 of file Event.h.

Referenced by ~Event().

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

Definition at line 183 of file Event.h.

Referenced by getLuminosityBlock().

bool fwlite::Event::parameterSetRegistryFilled_
mutableprivate

Definition at line 198 of file Event.h.

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

edm::EventAuxiliary const* fwlite::Event::pAux_
private

Definition at line 194 of file Event.h.

Referenced by Event().

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

Definition at line 195 of file Event.h.

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

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

Definition at line 191 of file Event.h.

Referenced by getProcessHistory(), and history().

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

Definition at line 184 of file Event.h.

Referenced by getRun().

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

Definition at line 201 of file Event.h.

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