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 (const char *varexp, const TCut &selection, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0)
 
Long64_t draw (const char *varexp, const char *selection, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0)
 
 Event (TFile *iFile)
 
virtual edm::EventAuxiliary const & eventAuxiliary () const
 
const std::vector
< edm::BranchDescription > & 
getBranchDescriptions () const
 
virtual const std::string getBranchNameFor (const std::type_info &, const char *iModuleLabel, const char *iProductInstanceLabel, const char *iProcessName) const
 Return the branch name in the TFile which contains the data. More...
 
virtual bool getByLabel (const std::type_info &, const char *, const char *, const char *, void *) const
 This function should only be called by fwlite::Handle<> More...
 
edm::EDProduct const * getByProductID (edm::ProductID const &) const
 
fwlite::LuminosityBlock const & getLuminosityBlock () const
 
const std::vector< std::string > & 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
 
const Eventoperator++ ()
 Advance to next event in the TFile. More...
 
edm::ProcessHistory const & processHistory () const
 
Long64_t scan (const char *varexp="", const char *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)
 
const EventtoBegin ()
 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<class T >
bool getByLabel (const InputTag &, 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 (const std::type_info &, const char *, const char *, const char *)
 

Private Member Functions

 Event (const Event &)
 
void fillParameterSetRegistry () const
 
const edm::ProcessHistoryhistory () const
 
const Eventoperator= (const Event &)
 
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< const char * > 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 74 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().

74  :
75  file_(iFile),
76 // eventTree_(0),
78 // eventIndex_(-1),
79  branchMap_(iFile),
80  pAux_(&aux_),
81  pOldAux_(0),
82  fileVersion_(-1),
85  boost::shared_ptr<HistoryGetterBase>(new EventHistoryGetter(this)),
86  boost::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
87  boost::shared_ptr<edm::EDProductGetter>(new internal::ProductGetter(this)),
88  true) {
89  if(0 == iFile) {
90  throw cms::Exception("NoFile") << "The TFile pointer passed to the constructor was null";
91  }
92 
93  if(0 == branchMap_.getEventTree()) {
94  throw cms::Exception("NoEventTree") << "The TFile contains no TTree named " << edm::poolNames::eventTreeName();
95  }
96  //need to know file version in order to determine how to read the basic event info
98 
99  //got this logic from IOPool/Input/src/RootFile.cc
100 
101  TTree* eventTree = branchMap_.getEventTree();
102  if(fileVersion_ >= 3 ) {
103  auxBranch_ = eventTree->GetBranch(edm::BranchTypeToAuxiliaryBranchName(edm::InEvent).c_str());
104  if(0 == auxBranch_) {
105  throw cms::Exception("NoEventAuxilliary") << "The TTree "
107  << " does not contain a branch named 'EventAuxiliary'";
108  }
109  auxBranch_->SetAddress(&pAux_);
110  } else {
111  pOldAux_ = new edm::EventAux();
112  auxBranch_ = eventTree->GetBranch(edm::BranchTypeToAuxBranchName(edm::InEvent).c_str());
113  if(0 == auxBranch_) {
114  throw cms::Exception("NoEventAux") << "The TTree "
116  << " does not contain a branch named 'EventAux'";
117  }
118  auxBranch_->SetAddress(&pOldAux_);
119  }
121 
122  if(fileVersion_ >= 7 && fileVersion_ < 17) {
123  eventHistoryTree_ = dynamic_cast<TTree*>(iFile->Get(edm::poolNames::eventHistoryTreeName().c_str()));
124  }
125  runFactory_ = boost::shared_ptr<RunFactory>(new RunFactory());
126 
127 }
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:108
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
boost::shared_ptr< RunFactory > runFactory_
Definition: Event.h:199
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:244
std::string const & BranchTypeToAuxBranchName(BranchType const &branchType)
Definition: BranchType.cc:112
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:252
TBranch * auxBranch_
Definition: Event.h:194
Event::~Event ( )
virtual

Definition at line 134 of file Event.cc.

References labels_, and pOldAux_.

134  {
135  for(std::vector<const char*>::iterator it = labels_.begin(), itEnd = labels_.end();
136  it != itEnd;
137  ++it) {
138  delete [] *it;
139  }
140  delete pOldAux_;
141 }
std::vector< const char * > labels_
Definition: Event.h:186
edm::EventAux * pOldAux_
Definition: Event.h:193
fwlite::Event::Event ( const Event )
private

Member Function Documentation

bool Event::atEnd ( ) const
virtual

Implements fwlite::EventBase.

Definition at line 248 of file Event.cc.

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

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

248  {
249  Long_t eventIndex = branchMap_.getEventEntry();
250  return eventIndex == -1 or eventIndex == size();
251 }
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:232
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 213 of file Event.cc.

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

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

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

Definition at line 217 of file Event.cc.

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

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

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

Definition at line 221 of file Event.cc.

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

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

221  {
222  GetterOperate op(dataHelper_.getter());
223  return branchMap_.getEventTree()->Draw(varexp,selection,option,nentries,firstentry);
224 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
edm::EDProductGetter * getter()
TTree * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
edm::EventAuxiliary const & Event::eventAuxiliary ( ) const
virtual

Implements edm::EventBase.

Definition at line 291 of file Event.cc.

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

Referenced by getLuminosityBlock(), and getRun().

291  {
292  Long_t eventIndex = branchMap_.getEventEntry();
293  updateAux(eventIndex);
294  return aux_;
295 }
Long_t getEventEntry() const
void updateAux(Long_t eventIndex) const
Definition: Event.cc:298
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
edm::EventAuxiliary aux_
Definition: Event.h:190
void Event::fillParameterSetRegistry ( ) const
private

Definition at line 397 of file Event.cc.

References b, branchMap_, edm::hlt::Exception, edm::poolNames::fileFormatVersionBranchName(), fwlite::BranchMapReader::getFile(), i, edm::poolNames::idToParameterSetBlobsBranchName(), edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::poolNames::metaDataTreeName(), edm::poolNames::parameterSetMapBranchName(), parameterSetRegistryFilled_, edm::FileFormatVersion::parameterSetsByReference(), edm::poolNames::parameterSetsTreeName(), MultipleCompare::pset, and edm::FileFormatVersion::triggerPathsTracked().

Referenced by triggerNames(), and triggerResultsByName().

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

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

Implements fwlite::EventBase.

Definition at line 268 of file Event.cc.

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

Referenced by FWFileEntry::runFilter().

271  {
272  return dataHelper_.getBranchNameFor(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel);
273 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
virtual const std::string getBranchNameFor(const std::type_info &, const char *, const char *, const char *) const
bool Event::getByLabel ( const std::type_info &  iInfo,
const char *  iModuleLabel,
const char *  iProductInstanceLabel,
const char *  iProcessLabel,
void *  oData 
) const
virtual

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

Implements fwlite::EventBase.

Definition at line 277 of file Event.cc.

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

281  {
282  if(atEnd()) {
283  throw cms::Exception("OffEnd") << "You have requested data past the last event";
284  }
285  Long_t eventIndex = branchMap_.getEventEntry();
286  return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, oData, eventIndex);
287 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
Long_t getEventEntry() const
virtual bool atEnd() const
Definition: Event.cc:248
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
virtual bool getByLabel(const std::type_info &, const char *, const char *, const char *, void *, Long_t) const
edm::EDProduct const * Event::getByProductID ( edm::ProductID const &  iID) const

Definition at line 374 of file Event.cc.

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

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

374  {
375  Long_t eventIndex = branchMap_.getEventEntry();
376  return dataHelper_.getByProductID(iID, eventIndex);
377 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
edm::EDProduct const * getByProductID(edm::ProductID const &, Long_t) const
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
fwlite::LuminosityBlock const & Event::getLuminosityBlock ( ) const

Definition at line 481 of file Event.cc.

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

Referenced by main().

481  {
482  if (not lumi_) {
483  // Branch map pointer not really being shared, owned by event, have to trick Lumi
484  lumi_ = boost::shared_ptr<fwlite::LuminosityBlock> (
485  new fwlite::LuminosityBlock(boost::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
486  runFactory_)
487  );
488  }
491  lumi_->to(run, lumi);
492  return *lumi_;
493 }
tuple lumi
Definition: fjr2json.py:41
RunNumber_t run() const
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
boost::shared_ptr< fwlite::LuminosityBlock > lumi_
Definition: Event.h:181
LuminosityBlockNumber_t luminosityBlock() const
boost::shared_ptr< RunFactory > runFactory_
Definition: Event.h:199
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:291
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
unsigned int RunNumber_t
Definition: EventRange.h:32
const std::vector< std::string > & Event::getProcessHistory ( ) const

Definition at line 255 of file Event.cc.

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

Referenced by FWLiteJobMetadataManager::doUpdate().

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

Definition at line 495 of file Event.cc.

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

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

495  {
496  run_ = runFactory_->makeRun(boost::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()));
498  run_->to(run);
499  return *run_;
500 }
RunNumber_t run() const
boost::shared_ptr< RunFactory > runFactory_
Definition: Event.h:199
boost::shared_ptr< fwlite::Run > run_
Definition: Event.h:182
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: Event.cc:291
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
unsigned int RunNumber_t
Definition: EventRange.h:32
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 309 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_, i, edm::EventAuxiliary::id(), edm::poolNames::metaDataTreeName(), edm::poolNames::processHistoryBranchName(), edm::History::processHistoryID(), edm::EventAuxiliary::processHistoryID(), edm::poolNames::processHistoryMapBranchName(), procHistoryNames_, filterCSVwithJSON::target, and updateAux().

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

309  {
310  edm::ProcessHistoryID processHistoryID;
311 
312  bool newFormat = (fileVersion_ >= 5);
313 
314  Long_t eventIndex = branchMap_.getEventEntry();
315  updateAux(eventIndex);
316  if (!newFormat) {
317  processHistoryID = aux_.processHistoryID();
318  }
319  if(historyMap_.empty() || newFormat) {
320  procHistoryNames_.clear();
321  TTree *meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
322  if(0 == meta) {
323  throw cms::Exception("NoMetaTree") << "The TFile does not appear to contain a TTree named "
325  }
326  if (historyMap_.empty()) {
327  if (fileVersion_ < 11) {
329  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryMapBranchName().c_str());
330  b->SetAddress(&pPhm);
331  b->GetEntry(0);
332  } else {
333  edm::ProcessHistoryVector historyVector;
334  edm::ProcessHistoryVector* pPhv = &historyVector;
335  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryBranchName().c_str());
336  b->SetAddress(&pPhv);
337  b->GetEntry(0);
338  for (edm::ProcessHistoryVector::const_iterator i = historyVector.begin(), e = historyVector.end();
339  i != e; ++i) {
340  historyMap_.insert(std::make_pair(i->id(), *i));
341  }
342  }
343  }
344  if (newFormat) {
345  if (fileVersion_ >= 17) {
346  processHistoryID = aux_.processHistoryID();
347  } else if (fileVersion_ >= 7) {
349  edm::History* pHistory = &history;
350  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
351  if (!eventHistoryBranch)
353  << "Failed to find history branch in event history tree";
354  eventHistoryBranch->SetAddress(&pHistory);
355  eventHistoryTree_->GetEntry(eventIndex);
356  processHistoryID = history.processHistoryID();
357  } else {
358  std::vector<edm::EventProcessHistoryID> *pEventProcessHistoryIDs = &eventProcessHistoryIDs_;
359  TBranch* b = meta->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
360  b->SetAddress(&pEventProcessHistoryIDs);
361  b->GetEntry(0);
363  processHistoryID = std::lower_bound(eventProcessHistoryIDs_.begin(), eventProcessHistoryIDs_.end(), target)->processHistoryID();
364  }
365  }
366 
367  }
368 
369  return historyMap_[processHistoryID];
370 }
edm::ProcessHistoryMap historyMap_
Definition: Event.h:187
int i
Definition: DBlmapReader.cc:9
ProcessHistoryRegistry::collection_type ProcessHistoryMap
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:182
std::vector< std::string > procHistoryNames_
Definition: Event.h:189
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:222
ProcessHistoryID const & processHistoryID() const
Definition: History.h:46
void updateAux(Long_t eventIndex) const
Definition: Event.cc:298
ProcessHistoryRegistry::vector_type ProcessHistoryVector
std::string const & metaDataTreeName()
Definition: BranchType.cc:157
Hash< ProcessHistoryType > ProcessHistoryID
std::string const & processHistoryBranchName()
Definition: BranchType.cc:187
const edm::ProcessHistory & history() const
Definition: Event.cc:309
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
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 168 of file Event.cc.

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

168  {
171  return (entry == EntryFinder::invalidEntry) ? -1 : entry;
172 }
tuple lumi
Definition: fjr2json.py:41
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
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
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 237 of file Event.cc.

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

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

Definition at line 243 of file Event.cc.

243  {
244  return isValid();
245 }
bool isValid() const
Definition: Event.cc:237
const Event & Event::operator++ ( )
virtual

Advance to next event in the TFile.

Implements fwlite::EventBase.

Definition at line 159 of file Event.cc.

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

159  {
160  Long_t eventIndex = branchMap_.getEventEntry();
161  if(eventIndex < size()) {
162  branchMap_.updateEvent(++eventIndex);
163  }
164  return *this;
165 }
bool updateEvent(Long_t eventEntry)
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:232
Long_t getEventEntry() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
const Event& fwlite::Event::operator= ( const Event )
private
edm::ProcessHistory const& fwlite::Event::processHistory ( ) const
inlinevirtual

Implements edm::EventBase.

Definition at line 153 of file Event.h.

References history().

153 {return history();}
const edm::ProcessHistory & history() const
Definition: Event.cc:309
Long64_t Event::scan ( const char *  varexp = "",
const char *  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().

225  {
226  GetterOperate op(dataHelper_.getter());
227  return branchMap_.getEventTree()->Scan(varexp,selection,option,nentries,firstentry);
228 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:198
edm::EDProductGetter * getter()
TTree * getEventTree() const
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
void fwlite::Event::setGetter ( boost::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(boost::shared_ptr< edm::EDProductGetter > getter)
Long64_t Event::size ( void  ) const

Returns number of events in the file.

Definition at line 232 of file Event.cc.

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

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

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

Definition at line 473 of file Event.cc.

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

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

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

Go to the event at index iIndex.

Definition at line 175 of file Event.cc.

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

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

175  {
176  if (iEntry < size()) {
177  // this is a valid entry
178  return branchMap_.updateEvent(iEntry);
179  }
180  // if we're here, then iEntry was not valid
181  return false;
182 }
bool updateEvent(Long_t eventEntry)
Long64_t size() const
Returns number of events in the file.
Definition: Event.cc:232
fwlite::BranchMapReader branchMap_
Definition: Event.h:183
bool Event::to ( const edm::EventID id)

Go to event by Run & Event number.

Definition at line 200 of file Event.cc.

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

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

References to().

185  {
186  return to(run, 0U, event);
187 }
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: Event.cc:175
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 190 of file Event.cc.

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

190  {
193  if (entry == EntryFinder::invalidEntry) {
194  return false;
195  }
196  return branchMap_.updateEvent(entry);
197 }
tuple lumi
Definition: fjr2json.py:41
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
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
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
const Event & Event::toBegin ( )
virtual

Go to the very first Event.

Implements fwlite::EventBase.

Definition at line 205 of file Event.cc.

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

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

205  {
207  return *this;
208 }
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 381 of file Event.cc.

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

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

381  {
382  edm::TriggerNames const* names = triggerNames_(triggerResults);
383  if (names != 0) return *names;
384 
387  names = triggerNames_(triggerResults);
388  }
389  if (names != 0) return *names;
390 
391  throw cms::Exception("TriggerNamesNotFound")
392  << "TriggerNames not found in ParameterSet registry";
393  return *names;
394 }
bool parameterSetRegistryFilled_
Definition: Event.h:196
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:42
void fillParameterSetRegistry() const
Definition: Event.cc:397
static const HistoName names[]
edm::TriggerResultsByName Event::triggerResultsByName ( std::string const &  process) const
virtual

Implements edm::EventBase.

Definition at line 453 of file Event.cc.

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

453  {
454 
455  fwlite::Handle<edm::TriggerResults> hTriggerResults;
456  hTriggerResults.getByLabel(*this,"TriggerResults","",process.c_str());
457  if ( !hTriggerResults.isValid()) {
458  return edm::TriggerResultsByName(0,0);
459  }
460 
461  edm::TriggerNames const* names = triggerNames_(*hTriggerResults);
462  if (names == 0 && !parameterSetRegistryFilled_) {
464  names = triggerNames_(*hTriggerResults);
465  }
466  return edm::TriggerResultsByName(hTriggerResults.product(), names);
467 }
bool isValid() const
Definition: Handle.h:58
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
Definition: Handle.h:88
bool parameterSetRegistryFilled_
Definition: Event.h:196
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:42
tuple process
Definition: align_tpl.py:3
void fillParameterSetRegistry() const
Definition: Event.cc:397
T const * product() const
Definition: Handle.h:63
static const HistoName names[]
void Event::updateAux ( Long_t  eventIndex) const
private

Definition at line 298 of file Event.cc.

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

Referenced by eventAuxiliary(), and history().

298  {
299  if(auxBranch_->GetEntryNumber() != eventIndex) {
300  auxBranch_->GetEntry(eventIndex);
301  //handling dealing with old version
302  if(0 != pOldAux_) {
304  }
305  }
306 }
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<const char*> fwlite::Event::labels_
mutableprivate

Definition at line 186 of file Event.h.

Referenced by ~Event().

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

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

Definition at line 182 of file Event.h.

Referenced by getRun().

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

Definition at line 199 of file Event.h.

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