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 bool getByLabel (std::type_info const &, char const *, char const *, char const *, edm::WrapperHolder &) const
 
edm::WrapperHolder 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 (boost::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_
 
boost::shared_ptr
< fwlite::LuminosityBlock
lumi_
 
bool parameterSetRegistryFilled_
 
edm::EventAuxiliarypAux_
 
edm::EventAuxpOldAux_
 
std::vector< std::string > procHistoryNames_
 
boost::shared_ptr< fwlite::Runrun_
 
boost::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 82 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().

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

Definition at line 142 of file Event.cc.

References labels_, and pOldAux_.

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

Member Function Documentation

bool Event::atEnd ( ) const
virtual

Implements fwlite::EventBase.

Definition at line 256 of file Event.cc.

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

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

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

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

Definition at line 221 of file Event.cc.

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

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

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

Definition at line 225 of file Event.cc.

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

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

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

Definition at line 229 of file Event.cc.

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

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

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

Implements edm::EventBase.

Definition at line 311 of file Event.cc.

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

Referenced by getLuminosityBlock(), and getRun().

311  {
312  Long_t eventIndex = branchMap_.getEventEntry();
313  updateAux(eventIndex);
314  return aux_;
315 }
Long_t getEventEntry() const
void updateAux(Long_t eventIndex) const
Definition: Event.cc:318
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
edm::EventAuxiliary aux_
Definition: Event.h:191
void Event::fillParameterSetRegistry ( ) const
private

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

416  {
417  if (parameterSetRegistryFilled_) return;
419 
420  TTree* meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
421  if (0 == meta) {
422  throw cms::Exception("NoMetaTree") << "The TFile does not contain a TTree named "
424  }
425 
426  edm::FileFormatVersion fileFormatVersion;
427  edm::FileFormatVersion *fftPtr = &fileFormatVersion;
428  if(meta->FindBranch(edm::poolNames::fileFormatVersionBranchName().c_str()) != 0) {
429  TBranch *fft = meta->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str());
430  fft->SetAddress(&fftPtr);
431  fft->GetEntry(0);
432  }
433 
434  typedef std::map<edm::ParameterSetID, edm::ParameterSetBlob> PsetMap;
435  PsetMap psetMap;
436  TTree* psetTree(0);
437  if (meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != 0) {
438  PsetMap *psetMapPtr = &psetMap;
439  TBranch* b = meta->GetBranch(edm::poolNames::parameterSetMapBranchName().c_str());
440  b->SetAddress(&psetMapPtr);
441  b->GetEntry(0);
442  } else if(0 == (psetTree = dynamic_cast<TTree *>(branchMap_.getFile()->Get(edm::poolNames::parameterSetsTreeName().c_str())))) {
443  throw cms::Exception("NoParameterSetMapTree")
444  << "The TTree "
445  << edm::poolNames::parameterSetsTreeName() << " could not be found in the file.";
446  } else {
447  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
448  IdToBlobs idToBlob;
449  IdToBlobs* pIdToBlob = &idToBlob;
450  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
451  for(long long i = 0; i != psetTree->GetEntries(); ++i) {
452  psetTree->GetEntry(i);
453  psetMap.insert(idToBlob);
454  }
455  }
457  if(!fileFormatVersion.triggerPathsTracked()) {
458  edm::ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion.parameterSetsByReference());
459  } else {
460  // Merge into the parameter set registry.
462  for(PsetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end();
463  i != iEnd; ++i) {
464  edm::ParameterSet pset(i->second.pset());
465  pset.setID(i->first);
466  psetRegistry.insertMapped(pset);
467  }
468  }
469 }
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:197
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:184
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 140 of file Event.h.

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

Referenced by FWLiteJobMetadataManager::doUpdate().

140  {
142  }
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
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 276 of file Event.cc.

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

Referenced by FWFileEntry::runFilter().

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

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

289  {
290  if(atEnd()) {
291  throw cms::Exception("OffEnd") << "You have requested data past the last event";
292  }
293  Long_t eventIndex = branchMap_.getEventEntry();
294  return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, oData, eventIndex);
295 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:199
Long_t getEventEntry() const
virtual bool atEnd() const
Definition: Event.cc:256
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *, Long_t) const
bool Event::getByLabel ( std::type_info const &  iInfo,
char const *  iModuleLabel,
char const *  iProductInstanceLabel,
char const *  iProcessLabel,
edm::WrapperHolder holder 
) const
virtual

Implements fwlite::EventBase.

Definition at line 298 of file Event.cc.

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

302  {
303  if(atEnd()) {
304  throw cms::Exception("OffEnd") << "You have requested data past the last event";
305  }
306  Long_t eventIndex = branchMap_.getEventEntry();
307  return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, holder, eventIndex);
308 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:199
Long_t getEventEntry() const
virtual bool atEnd() const
Definition: Event.cc:256
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *, Long_t) const
edm::WrapperHolder Event::getByProductID ( edm::ProductID const &  iID) const

Definition at line 393 of file Event.cc.

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

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

393  {
394  Long_t eventIndex = branchMap_.getEventEntry();
395  return dataHelper_.getByProductID(iID, eventIndex);
396 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:199
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
edm::WrapperHolder getByProductID(edm::ProductID const &, Long_t) const
fwlite::LuminosityBlock const & Event::getLuminosityBlock ( ) const

Definition at line 500 of file Event.cc.

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

Referenced by main().

500  {
501  if (not lumi_) {
502  // Branch map pointer not really being shared, owned by event, have to trick Lumi
503  lumi_ = boost::shared_ptr<fwlite::LuminosityBlock> (
504  new fwlite::LuminosityBlock(boost::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
505  runFactory_)
506  );
507  }
510  lumi_->to(run, lumi);
511  return *lumi_;
512 }
tuple lumi
Definition: fjr2json.py:35
RunNumber_t run() const
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
boost::shared_ptr< fwlite::LuminosityBlock > lumi_
Definition: Event.h:182
LuminosityBlockNumber_t luminosityBlock() const
boost::shared_ptr< RunFactory > runFactory_
Definition: Event.h:200
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:311
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
unsigned int RunNumber_t
Definition: EventRange.h:32
std::vector< std::string > const & Event::getProcessHistory ( ) const

Definition at line 263 of file Event.cc.

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

Referenced by FWLiteJobMetadataManager::doUpdate().

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

Definition at line 514 of file Event.cc.

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

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

514  {
515  run_ = runFactory_->makeRun(boost::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()));
517  run_->to(run);
518  return *run_;
519 }
RunNumber_t run() const
boost::shared_ptr< RunFactory > runFactory_
Definition: Event.h:200
boost::shared_ptr< fwlite::Run > run_
Definition: Event.h:183
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:311
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
unsigned int RunNumber_t
Definition: EventRange.h:32
TFile* fwlite::Event::getTFile ( ) const
inline

Definition at line 144 of file Event.h.

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

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

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

329  {
330  edm::ProcessHistoryID processHistoryID;
331 
332  bool newFormat = (fileVersion_ >= 5);
333 
334  Long_t eventIndex = branchMap_.getEventEntry();
335  updateAux(eventIndex);
336  if (!newFormat) {
337  processHistoryID = aux_.processHistoryID();
338  }
339  if(historyMap_.empty() || newFormat) {
340  procHistoryNames_.clear();
341  TTree *meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
342  if(0 == meta) {
343  throw cms::Exception("NoMetaTree") << "The TFile does not appear to contain a TTree named "
345  }
346  if (historyMap_.empty()) {
347  if (fileVersion_ < 11) {
349  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryMapBranchName().c_str());
350  b->SetAddress(&pPhm);
351  b->GetEntry(0);
352  } else {
353  edm::ProcessHistoryVector historyVector;
354  edm::ProcessHistoryVector* pPhv = &historyVector;
355  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryBranchName().c_str());
356  b->SetAddress(&pPhv);
357  b->GetEntry(0);
358  for (auto& history : historyVector) {
359  historyMap_.insert(std::make_pair(history.setProcessHistoryID(), history));
360  }
361  }
362  }
363  if (newFormat) {
364  if (fileVersion_ >= 17) {
365  processHistoryID = aux_.processHistoryID();
366  } else if (fileVersion_ >= 7) {
368  edm::History* pHistory = &history;
369  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
370  if (!eventHistoryBranch)
372  << "Failed to find history branch in event history tree";
373  eventHistoryBranch->SetAddress(&pHistory);
374  eventHistoryTree_->GetEntry(eventIndex);
375  processHistoryID = history.processHistoryID();
376  } else {
377  std::vector<edm::EventProcessHistoryID> *pEventProcessHistoryIDs = &eventProcessHistoryIDs_;
378  TBranch* b = meta->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
379  b->SetAddress(&pEventProcessHistoryIDs);
380  b->GetEntry(0);
382  processHistoryID = std::lower_bound(eventProcessHistoryIDs_.begin(), eventProcessHistoryIDs_.end(), target)->processHistoryID();
383  }
384  }
385 
386  }
387 
388  return historyMap_[processHistoryID];
389 }
std::vector< ProcessHistory > ProcessHistoryVector
edm::ProcessHistoryMap historyMap_
Definition: Event.h:188
ProcessHistoryID setProcessHistoryID()
TFile * getFile() const
TTree * eventHistoryTree_
Definition: Event.h:180
int fileVersion_
Definition: Event.h:196
Long_t getEventEntry() const
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:192
std::vector< std::string > procHistoryNames_
Definition: Event.h:190
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:318
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:329
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
double b
Definition: hdecay.h:120
edm::EventAuxiliary aux_
Definition: Event.h:191
std::vector< edm::EventProcessHistoryID > eventProcessHistoryIDs_
Definition: Event.h:189
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 176 of file Event.cc.

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

176  {
179  return (entry == EntryFinder::invalidEntry) ? -1 : entry;
180 }
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:184
EntryFinder entryFinder_
Definition: Event.h:192
bool Event::isValid ( void  ) const

Definition at line 245 of file Event.cc.

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

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

Definition at line 251 of file Event.cc.

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

Advance to next event in the TFile.

Implements fwlite::EventBase.

Definition at line 167 of file Event.cc.

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

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

Implements edm::EventBase.

Definition at line 154 of file Event.h.

References history().

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

Definition at line 233 of file Event.cc.

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

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

Definition at line 175 of file Event.h.

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

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

Returns number of events in the file.

Definition at line 240 of file Event.cc.

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

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

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

Definition at line 492 of file Event.cc.

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

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

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

Go to the event at index iIndex.

Definition at line 183 of file Event.cc.

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

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

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

Go to event by Run & Event number.

Definition at line 208 of file Event.cc.

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

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

References to().

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

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

198  {
201  if (entry == EntryFinder::invalidEntry) {
202  return false;
203  }
204  return branchMap_.updateEvent(entry);
205 }
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:184
EntryFinder entryFinder_
Definition: Event.h:192
Event const & Event::toBegin ( )
virtual

Go to the very first Event.

Implements fwlite::EventBase.

Definition at line 213 of file Event.cc.

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

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

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

Implements edm::EventBase.

Definition at line 400 of file Event.cc.

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

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

400  {
402  if (names != 0) return *names;
403 
406  names = triggerNames_(triggerResults);
407  }
408  if (names != 0) return *names;
409 
410  throw cms::Exception("TriggerNamesNotFound")
411  << "TriggerNames not found in ParameterSet registry";
412  return *names;
413 }
static const HistoName names[]
bool parameterSetRegistryFilled_
Definition: Event.h:197
static std::string const triggerResults
Definition: EdmProvDump.cc:41
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:42
void fillParameterSetRegistry() const
Definition: Event.cc:416
edm::TriggerResultsByName Event::triggerResultsByName ( std::string const &  process) const
virtual

Implements edm::EventBase.

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

472  {
473 
474  fwlite::Handle<edm::TriggerResults> hTriggerResults;
475  hTriggerResults.getByLabel(*this, "TriggerResults", "", process.c_str());
476  if (!hTriggerResults.isValid()) {
477  return edm::TriggerResultsByName(0,0);
478  }
479 
480  edm::TriggerNames const* names = triggerNames_(*hTriggerResults);
481  if (names == 0 && !parameterSetRegistryFilled_) {
483  names = triggerNames_(*hTriggerResults);
484  }
485  return edm::TriggerResultsByName(hTriggerResults.product(), names);
486 }
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:197
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:42
void fillParameterSetRegistry() const
Definition: Event.cc:416
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 318 of file Event.cc.

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

Referenced by eventAuxiliary(), and history().

318  {
319  if(auxBranch_->GetEntryNumber() != eventIndex) {
320  auxBranch_->GetEntry(eventIndex);
321  //handling dealing with old version
322  if(0 != pOldAux_) {
324  }
325  }
326 }
edm::EventAux * pOldAux_
Definition: Event.h:194
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
edm::EventAuxiliary aux_
Definition: Event.h:191
TBranch * auxBranch_
Definition: Event.h:195

Friends And Related Function Documentation

friend class ChainEvent
friend

Definition at line 165 of file Event.h.

friend class EventHistoryGetter
friend

Definition at line 166 of file Event.h.

friend class internal::ProductGetter
friend

Definition at line 164 of file Event.h.

Member Data Documentation

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

Definition at line 191 of file Event.h.

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

TBranch* fwlite::Event::auxBranch_
private

Definition at line 195 of file Event.h.

Referenced by Event(), and updateAux().

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

Definition at line 199 of file Event.h.

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

EntryFinder fwlite::Event::entryFinder_
mutableprivate

Definition at line 192 of file Event.h.

Referenced by indexFromEventId(), and to().

TTree* fwlite::Event::eventHistoryTree_
private

Definition at line 180 of file Event.h.

Referenced by Event(), and history().

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

Definition at line 189 of file Event.h.

Referenced by history().

TFile* fwlite::Event::file_
private

Definition at line 178 of file Event.h.

int fwlite::Event::fileVersion_
private

Definition at line 196 of file Event.h.

Referenced by Event(), and history().

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

Definition at line 188 of file Event.h.

Referenced by history().

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

Definition at line 187 of file Event.h.

Referenced by ~Event().

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

Definition at line 182 of file Event.h.

Referenced by getLuminosityBlock().

bool fwlite::Event::parameterSetRegistryFilled_
mutableprivate

Definition at line 197 of file Event.h.

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

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

Definition at line 193 of file Event.h.

Referenced by Event().

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

Definition at line 194 of file Event.h.

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

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

Definition at line 190 of file Event.h.

Referenced by getProcessHistory(), and history().

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

Definition at line 183 of file Event.h.

Referenced by getRun().

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

Definition at line 200 of file Event.h.

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