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...
 
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
 
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 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 > 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::EventAuxiliarypAux_
 
edm::EventAuxpOldAux_
 
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 86 of file Event.h.

Constructor & Destructor Documentation

Event::Event ( TFile *  iFile)

Definition at line 81 of file Event.cc.

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

81  :
82  file_(iFile),
83 // eventTree_(0),
85 // eventIndex_(-1),
86  branchMap_(iFile),
87  pAux_(&aux_),
88  pOldAux_(0),
89  fileVersion_(-1),
92  std::shared_ptr<HistoryGetterBase>(new EventHistoryGetter(this)),
93  std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
94  std::shared_ptr<edm::EDProductGetter>(new internal::ProductGetter(this)),
95  true) {
96  if(0 == iFile) {
97  throw cms::Exception("NoFile") << "The TFile pointer passed to the constructor was null";
98  }
99 
100  if(0 == branchMap_.getEventTree()) {
101  throw cms::Exception("NoEventTree") << "The TFile contains no TTree named " << edm::poolNames::eventTreeName();
102  }
103  //need to know file version in order to determine how to read the basic event info
105 
106  //got this logic from IOPool/Input/src/RootFile.cc
107 
108  TTree* eventTree = branchMap_.getEventTree();
109  if(fileVersion_ >= 3) {
110  auxBranch_ = eventTree->GetBranch(edm::BranchTypeToAuxiliaryBranchName(edm::InEvent).c_str());
111  if(0 == auxBranch_) {
112  throw cms::Exception("NoEventAuxilliary") << "The TTree "
114  << " does not contain a branch named 'EventAuxiliary'";
115  }
116  auxBranch_->SetAddress(&pAux_);
117  } else {
118  pOldAux_ = new edm::EventAux();
119  auxBranch_ = eventTree->GetBranch(edm::BranchTypeToAuxBranchName(edm::InEvent).c_str());
120  if(0 == auxBranch_) {
121  throw cms::Exception("NoEventAux") << "The TTree "
123  << " does not contain a branch named 'EventAux'";
124  }
125  auxBranch_->SetAddress(&pOldAux_);
126  }
128 
129  if(fileVersion_ >= 7 && fileVersion_ < 17) {
130  eventHistoryTree_ = dynamic_cast<TTree*>(iFile->Get(edm::poolNames::eventHistoryTreeName().c_str()));
131  }
132  runFactory_ = std::shared_ptr<RunFactory>(new RunFactory());
133 
134 }
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:114
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
bool updateEvent(Long_t eventEntry)
TTree * eventHistoryTree_
Definition: Event.h:179
int fileVersion_
Definition: Event.h:195
edm::EventAux * pOldAux_
Definition: Event.h:193
TTree * getEventTree() const
int getFileVersion(TFile *file)
bool parameterSetRegistryFilled_
Definition: Event.h:196
friend class EventHistoryGetter
Definition: Event.h:165
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
TFile * file_
Definition: Event.h:177
edm::EventAuxiliary aux_
Definition: Event.h:190
edm::EventAuxiliary * pAux_
Definition: Event.h:192
std::string const & eventTreeName()
Definition: BranchType.cc:254
std::string const & BranchTypeToAuxBranchName(BranchType const &branchType)
Definition: BranchType.cc:118
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:262
TBranch * auxBranch_
Definition: Event.h:194
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:199
Event::~Event ( )
virtual

Definition at line 141 of file Event.cc.

References labels_, and pOldAux_.

141  {
142  for(std::vector<char const*>::iterator it = labels_.begin(), itEnd = labels_.end();
143  it != itEnd;
144  ++it) {
145  delete [] *it;
146  }
147  delete pOldAux_;
148 }
edm::EventAux * pOldAux_
Definition: Event.h:193
std::vector< char const * > labels_
Definition: Event.h:186
fwlite::Event::Event ( Event const &  )
private

Member Function Documentation

bool Event::atEnd ( ) const
virtual

Implements fwlite::EventBase.

Definition at line 255 of file Event.cc.

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

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

255  {
256  Long_t eventIndex = branchMap_.getEventEntry();
257  return eventIndex == -1 or eventIndex == size();
258 }
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:239
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
void Event::draw ( Option_t *  opt)

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

Definition at line 220 of file Event.cc.

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

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

220  {
221  GetterOperate op(dataHelper_.getter());
222  branchMap_.getEventTree()->Draw(opt);
223 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
edm::EDProductGetter * getter()
TTree * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
Long64_t Event::draw ( char const *  varexp,
const TCut &  selection,
Option_t *  option = "",
Long64_t  nentries = 1000000000,
Long64_t  firstentry = 0 
)

Definition at line 224 of file Event.cc.

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

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

224  {
225  GetterOperate op(dataHelper_.getter());
226  return branchMap_.getEventTree()->Draw(varexp,selection,option,nentries,firstentry);
227 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
edm::EDProductGetter * getter()
selection
main part
Definition: corrVsCorr.py:98
TTree * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
Long64_t Event::draw ( char const *  varexp,
char const *  selection,
Option_t *  option = "",
Long64_t  nentries = 1000000000,
Long64_t  firstentry = 0 
)

Definition at line 228 of file Event.cc.

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

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

228  {
229  GetterOperate op(dataHelper_.getter());
230  return branchMap_.getEventTree()->Draw(varexp,selection,option,nentries,firstentry);
231 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
edm::EDProductGetter * getter()
selection
main part
Definition: corrVsCorr.py:98
TTree * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
edm::EventAuxiliary const & Event::eventAuxiliary ( ) const
virtual

Implements edm::EventBase.

Definition at line 297 of file Event.cc.

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

Referenced by getLuminosityBlock(), and getRun().

297  {
298  Long_t eventIndex = branchMap_.getEventEntry();
299  updateAux(eventIndex);
300  return aux_;
301 }
Long_t getEventEntry() const
void updateAux(Long_t eventIndex) const
Definition: Event.cc:304
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
edm::EventAuxiliary aux_
Definition: Event.h:190
void Event::fillParameterSetRegistry ( ) const
private

Definition at line 402 of file Event.cc.

References b, branchMap_, edm::hlt::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(), edm::ParameterSet::setID(), and edm::FileFormatVersion::triggerPathsTracked().

Referenced by triggerNames(), and triggerResultsByName().

402  {
403  if (parameterSetRegistryFilled_) return;
405 
406  TTree* meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
407  if (0 == meta) {
408  throw cms::Exception("NoMetaTree") << "The TFile does not contain a TTree named "
410  }
411 
412  edm::FileFormatVersion fileFormatVersion;
413  edm::FileFormatVersion *fftPtr = &fileFormatVersion;
414  if(meta->FindBranch(edm::poolNames::fileFormatVersionBranchName().c_str()) != 0) {
415  TBranch *fft = meta->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str());
416  fft->SetAddress(&fftPtr);
417  fft->GetEntry(0);
418  }
419 
420  typedef std::map<edm::ParameterSetID, edm::ParameterSetBlob> PsetMap;
421  PsetMap psetMap;
422  TTree* psetTree(0);
423  if (meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != 0) {
424  PsetMap *psetMapPtr = &psetMap;
425  TBranch* b = meta->GetBranch(edm::poolNames::parameterSetMapBranchName().c_str());
426  b->SetAddress(&psetMapPtr);
427  b->GetEntry(0);
428  } else if(0 == (psetTree = dynamic_cast<TTree *>(branchMap_.getFile()->Get(edm::poolNames::parameterSetsTreeName().c_str())))) {
429  throw cms::Exception("NoParameterSetMapTree")
430  << "The TTree "
431  << edm::poolNames::parameterSetsTreeName() << " could not be found in the file.";
432  } else {
433  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
434  IdToBlobs idToBlob;
435  IdToBlobs* pIdToBlob = &idToBlob;
436  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
437  for(long long i = 0; i != psetTree->GetEntries(); ++i) {
438  psetTree->GetEntry(i);
439  psetMap.insert(idToBlob);
440  }
441  }
443  if(!fileFormatVersion.triggerPathsTracked()) {
444  edm::ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion.parameterSetsByReference());
445  } else {
446  // Merge into the parameter set registry.
448  for(PsetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end();
449  i != iEnd; ++i) {
450  edm::ParameterSet pset(i->second.pset());
451  pset.setID(i->first);
452  psetRegistry.insertMapped(pset);
453  }
454  }
455 }
void setID(ParameterSetID const &id)
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:249
int i
Definition: DBlmapReader.cc:9
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:212
TFile * getFile() const
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:245
bool parameterSetRegistryFilled_
Definition: Event.h:196
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
std::string const & metaDataTreeName()
Definition: BranchType.cc:167
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:182
bool triggerPathsTracked() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
bool parameterSetsByReference() const
double b
Definition: hdecay.h:120
bool insertMapped(value_type const &v)
Definition: Registry.cc:37
static Registry * instance()
Definition: Registry.cc:14
std::vector<edm::BranchDescription> const& fwlite::Event::getBranchDescriptions ( ) const
inline

Definition at line 139 of file Event.h.

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

Referenced by FWLiteJobMetadataManager::doUpdate().

139  {
141  }
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
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 275 of file Event.cc.

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

Referenced by FWFileEntry::runFilter().

278  {
279  return dataHelper_.getBranchNameFor(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel);
280 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
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 283 of file Event.cc.

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

288  {
289  if(atEnd()) {
290  throw cms::Exception("OffEnd") << "You have requested data past the last event";
291  }
292  Long_t eventIndex = branchMap_.getEventEntry();
293  return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, oData, eventIndex);
294 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
Long_t getEventEntry() const
virtual bool atEnd() const
Definition: Event.cc:255
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
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

Definition at line 379 of file Event.cc.

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

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

379  {
380  Long_t eventIndex = branchMap_.getEventEntry();
381  return dataHelper_.getByProductID(iID, eventIndex);
382 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
Long_t getEventEntry() const
edm::WrapperBase const * getByProductID(edm::ProductID const &, Long_t) const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
fwlite::LuminosityBlock const & Event::getLuminosityBlock ( ) const

Definition at line 486 of file Event.cc.

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

Referenced by main().

486  {
487  if (not lumi_) {
488  // Branch map pointer not really being shared, owned by event, have to trick Lumi
489  lumi_ = std::shared_ptr<fwlite::LuminosityBlock> (
490  new fwlite::LuminosityBlock(std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
491  runFactory_)
492  );
493  }
496  lumi_->to(run, lumi);
497  return *lumi_;
498 }
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:297
std::shared_ptr< fwlite::LuminosityBlock > lumi_
Definition: Event.h:181
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
unsigned int RunNumber_t
Definition: EventRange.h:32
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:199
std::vector< std::string > const & Event::getProcessHistory ( ) const

Definition at line 262 of file Event.cc.

References edm::ProcessHistory::begin(), edm::ProcessHistory::end(), h, history(), and procHistoryNames_.

Referenced by FWLiteJobMetadataManager::doUpdate().

262  {
263  if (procHistoryNames_.empty()) {
264  const edm::ProcessHistory& h = history();
265  for (edm::ProcessHistory::const_iterator iproc = h.begin(), eproc = h.end();
266  iproc != eproc; ++iproc) {
267  procHistoryNames_.push_back(iproc->processName());
268  }
269  }
270  return procHistoryNames_;
271 }
collection_type::const_iterator const_iterator
const_iterator begin() const
std::vector< std::string > procHistoryNames_
Definition: Event.h:189
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
edm::ProcessHistory const & history() const
Definition: Event.cc:315
const_iterator end() const
fwlite::Run const & Event::getRun ( ) const

Definition at line 500 of file Event.cc.

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

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

500  {
501  run_ = runFactory_->makeRun(std::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()));
503  run_->to(run);
504  return *run_;
505 }
RunNumber_t run() const
std::shared_ptr< fwlite::Run > run_
Definition: Event.h:182
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:297
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
unsigned int RunNumber_t
Definition: EventRange.h:32
std::shared_ptr< RunFactory > runFactory_
Definition: Event.h:199
TFile* fwlite::Event::getTFile ( ) const
inline

Definition at line 143 of file Event.h.

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

143  {
144  return branchMap_.getFile();
145  }
TFile * getFile() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
const edm::ProcessHistory & Event::history ( ) const
private

Definition at line 315 of file Event.cc.

References aux_, b, branchMap_, edm::poolNames::eventHistoryBranchName(), eventHistoryTree_, eventProcessHistoryIDs_, edm::hlt::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().

315  {
316  edm::ProcessHistoryID processHistoryID;
317 
318  bool newFormat = (fileVersion_ >= 5);
319 
320  Long_t eventIndex = branchMap_.getEventEntry();
321  updateAux(eventIndex);
322  if (!newFormat) {
323  processHistoryID = aux_.processHistoryID();
324  }
325  if(historyMap_.empty() || newFormat) {
326  procHistoryNames_.clear();
327  TTree *meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
328  if(0 == meta) {
329  throw cms::Exception("NoMetaTree") << "The TFile does not appear to contain a TTree named "
331  }
332  if (historyMap_.empty()) {
333  if (fileVersion_ < 11) {
335  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryMapBranchName().c_str());
336  b->SetAddress(&pPhm);
337  b->GetEntry(0);
338  } else {
339  edm::ProcessHistoryVector historyVector;
340  edm::ProcessHistoryVector* pPhv = &historyVector;
341  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryBranchName().c_str());
342  b->SetAddress(&pPhv);
343  b->GetEntry(0);
344  for (auto& history : historyVector) {
345  historyMap_.insert(std::make_pair(history.setProcessHistoryID(), history));
346  }
347  }
348  }
349  if (newFormat) {
350  if (fileVersion_ >= 17) {
351  processHistoryID = aux_.processHistoryID();
352  } else if (fileVersion_ >= 7) {
354  edm::History* pHistory = &history;
355  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
356  if (!eventHistoryBranch)
358  << "Failed to find history branch in event history tree";
359  eventHistoryBranch->SetAddress(&pHistory);
360  eventHistoryTree_->GetEntry(eventIndex);
361  processHistoryID = history.processHistoryID();
362  } else {
363  std::vector<edm::EventProcessHistoryID> *pEventProcessHistoryIDs = &eventProcessHistoryIDs_;
364  TBranch* b = meta->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
365  b->SetAddress(&pEventProcessHistoryIDs);
366  b->GetEntry(0);
368  processHistoryID = std::lower_bound(eventProcessHistoryIDs_.begin(), eventProcessHistoryIDs_.end(), target)->processHistoryID();
369  }
370  }
371 
372  }
373 
374  return historyMap_[processHistoryID];
375 }
std::vector< ProcessHistory > ProcessHistoryVector
edm::ProcessHistoryMap historyMap_
Definition: Event.h:187
ProcessHistoryID setProcessHistoryID()
TFile * getFile() const
TTree * eventHistoryTree_
Definition: Event.h:179
int fileVersion_
Definition: Event.h:195
Long_t getEventEntry() const
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:192
std::vector< std::string > procHistoryNames_
Definition: Event.h:189
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:232
ProcessHistoryID const & processHistoryID() const
Definition: History.h:46
void updateAux(Long_t eventIndex) const
Definition: Event.cc:304
std::string const & metaDataTreeName()
Definition: BranchType.cc:167
Hash< ProcessHistoryType > ProcessHistoryID
std::string const & processHistoryBranchName()
Definition: BranchType.cc:197
edm::ProcessHistory const & history() const
Definition: Event.cc:315
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
double b
Definition: hdecay.h:120
edm::EventAuxiliary aux_
Definition: Event.h:190
std::vector< edm::EventProcessHistoryID > eventProcessHistoryIDs_
Definition: Event.h:188
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 175 of file Event.cc.

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

175  {
178  return (entry == EntryFinder::invalidEntry) ? -1 : entry;
179 }
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:34
void fillIndex(BranchMapReader const &branchMap)
Definition: EntryFinder.cc:108
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
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:40
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
EntryFinder entryFinder_
Definition: Event.h:191
bool Event::isValid ( void  ) const

Definition at line 244 of file Event.cc.

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

244  {
245  Long_t eventIndex = branchMap_.getEventEntry();
246  return eventIndex != -1 and eventIndex < size();
247 }
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:239
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
Event::operator bool ( ) const

Definition at line 250 of file Event.cc.

250  {
251  return isValid();
252 }
bool isValid() const
Definition: Event.cc:244
Event const & Event::operator++ ( )
virtual

Advance to next event in the TFile.

Implements fwlite::EventBase.

Definition at line 166 of file Event.cc.

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

166  {
167  Long_t eventIndex = branchMap_.getEventEntry();
168  if(eventIndex < size()) {
169  branchMap_.updateEvent(++eventIndex);
170  }
171  return *this;
172 }
bool updateEvent(Long_t eventEntry)
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:239
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
Event const& fwlite::Event::operator= ( Event const &  )
private
virtual edm::ProcessHistory const& fwlite::Event::processHistory ( ) const
inlinevirtual

Implements edm::EventBase.

Definition at line 153 of file Event.h.

References history().

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

Definition at line 232 of file Event.cc.

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

232  {
233  GetterOperate op(dataHelper_.getter());
234  return branchMap_.getEventTree()->Scan(varexp,selection,option,nentries,firstentry);
235 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
edm::EDProductGetter * getter()
selection
main part
Definition: corrVsCorr.py:98
TTree * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
void fwlite::Event::setGetter ( std::shared_ptr< edm::EDProductGetter getter)
inlineprivate

Definition at line 174 of file Event.h.

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

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

Returns number of events in the file.

Definition at line 239 of file Event.cc.

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

Referenced by atEnd(), FWHLTTriggerTableView::fillAverageAcceptFractions(), isValid(), operator++(), and to().

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

Definition at line 478 of file Event.cc.

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

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

478  {
479  edm::TypeID type(iType);
480  throw edm::Exception(edm::errors::ProductNotFound) << "A branch was found for \n type ='" << type.className() << "'\n module='" << iModule
481  << "'\n productInstance='" << ((0!=iProduct)?iProduct:"") << "'\n process='" << ((0 != iProcess) ? iProcess : "") << "'\n"
482  "but no data is available for this Event";
483 }
type
Definition: HCALResponse.h:21
bool Event::to ( Long64_t  iIndex)

Go to the event at index iIndex.

Definition at line 182 of file Event.cc.

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

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

182  {
183  if (iEntry < size()) {
184  // this is a valid entry
185  return branchMap_.updateEvent(iEntry);
186  }
187  // if we're here, then iEntry was not valid
188  return false;
189 }
bool updateEvent(Long_t eventEntry)
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:239
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
bool Event::to ( const edm::EventID id)

Go to event by Run & Event number.

Definition at line 207 of file Event.cc.

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

207  {
208  return to(id.run(), id.luminosityBlock(), id.event());
209 }
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: Event.cc:182
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 192 of file Event.cc.

References to().

192  {
193  return to(run, 0U, event);
194 }
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: Event.cc:182
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 197 of file Event.cc.

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

197  {
200  if (entry == EntryFinder::invalidEntry) {
201  return false;
202  }
203  return branchMap_.updateEvent(entry);
204 }
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:34
void fillIndex(BranchMapReader const &branchMap)
Definition: EntryFinder.cc:108
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
static EntryNumber_t const invalidEntry
Definition: EntryFinder.h:40
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
EntryFinder entryFinder_
Definition: Event.h:191
Event const & Event::toBegin ( )
virtual

Go to the very first Event.

Implements fwlite::EventBase.

Definition at line 212 of file Event.cc.

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

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

212  {
214  return *this;
215 }
bool updateEvent(Long_t eventEntry)
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
edm::TriggerNames const & Event::triggerNames ( edm::TriggerResults const &  triggerResults) const
virtual

Implements edm::EventBase.

Definition at line 386 of file Event.cc.

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

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

386  {
388  if (names != 0) return *names;
389 
392  names = triggerNames_(triggerResults);
393  }
394  if (names != 0) return *names;
395 
396  throw cms::Exception("TriggerNamesNotFound")
397  << "TriggerNames not found in ParameterSet registry";
398  return *names;
399 }
static const HistoName names[]
bool parameterSetRegistryFilled_
Definition: Event.h:196
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:402
edm::TriggerResultsByName Event::triggerResultsByName ( std::string const &  process) const
virtual

Implements edm::EventBase.

Definition at line 458 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_().

458  {
459 
460  fwlite::Handle<edm::TriggerResults> hTriggerResults;
461  hTriggerResults.getByLabel(*this, "TriggerResults", "", process.c_str());
462  if (!hTriggerResults.isValid()) {
463  return edm::TriggerResultsByName(0,0);
464  }
465 
466  edm::TriggerNames const* names = triggerNames_(*hTriggerResults);
467  if (names == 0 && !parameterSetRegistryFilled_) {
469  names = triggerNames_(*hTriggerResults);
470  }
471  return edm::TriggerResultsByName(hTriggerResults.product(), names);
472 }
static const HistoName names[]
bool isValid() const
Definition: Handle.h:64
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:94
bool parameterSetRegistryFilled_
Definition: Event.h:196
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:48
void fillParameterSetRegistry() const
Definition: Event.cc:402
T const * product() const
Definition: Handle.h:69
tuple process
Definition: LaserDQM_cfg.py:3
void Event::updateAux ( Long_t  eventIndex) const
private

Definition at line 304 of file Event.cc.

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

Referenced by eventAuxiliary(), and history().

304  {
305  if(auxBranch_->GetEntryNumber() != eventIndex) {
306  auxBranch_->GetEntry(eventIndex);
307  //handling dealing with old version
308  if(0 != pOldAux_) {
310  }
311  }
312 }
edm::EventAux * pOldAux_
Definition: Event.h:193
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
edm::EventAuxiliary aux_
Definition: Event.h:190
TBranch * auxBranch_
Definition: Event.h:194

Friends And Related Function Documentation

friend class ChainEvent
friend

Definition at line 164 of file Event.h.

friend class EventHistoryGetter
friend

Definition at line 165 of file Event.h.

friend class internal::ProductGetter
friend

Definition at line 163 of file Event.h.

Member Data Documentation

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

Definition at line 190 of file Event.h.

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

TBranch* fwlite::Event::auxBranch_
private

Definition at line 194 of file Event.h.

Referenced by Event(), and updateAux().

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

Definition at line 198 of file Event.h.

Referenced by draw(), getBranchNameFor(), getByLabel(), getByProductID(), scan(), and setGetter().

EntryFinder fwlite::Event::entryFinder_
mutableprivate

Definition at line 191 of file Event.h.

Referenced by indexFromEventId(), and to().

TTree* fwlite::Event::eventHistoryTree_
private

Definition at line 179 of file Event.h.

Referenced by Event(), and history().

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

Definition at line 188 of file Event.h.

Referenced by history().

TFile* fwlite::Event::file_
private

Definition at line 177 of file Event.h.

int fwlite::Event::fileVersion_
private

Definition at line 195 of file Event.h.

Referenced by Event(), and history().

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

Definition at line 187 of file Event.h.

Referenced by history().

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

Definition at line 186 of file Event.h.

Referenced by ~Event().

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

Definition at line 181 of file Event.h.

Referenced by getLuminosityBlock().

bool fwlite::Event::parameterSetRegistryFilled_
mutableprivate

Definition at line 196 of file Event.h.

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

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

Definition at line 192 of file Event.h.

Referenced by Event().

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

Definition at line 193 of file Event.h.

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

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

Definition at line 189 of file Event.h.

Referenced by getProcessHistory(), and history().

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

Definition at line 182 of file Event.h.

Referenced by getRun().

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

Definition at line 199 of file Event.h.

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