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 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: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 134 of file Event.cc.

References labels_, and pOldAux_.

134  {
135  for(std::vector<char const*>::iterator it = labels_.begin(), itEnd = labels_.end();
136  it != itEnd;
137  ++it) {
138  delete [] *it;
139  }
140  delete pOldAux_;
141 }
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 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:184
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 Vispa.Gui.PortConnection.PointToPointConnection::paintEvent().

213  {
214  GetterOperate op(dataHelper_.getter());
215  branchMap_.getEventTree()->Draw(opt);
216 }
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 217 of file Event.cc.

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

Referenced by 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: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 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  return branchMap_.getEventTree()->Draw(varexp,selection,option,nentries,firstentry);
224 }
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 303 of file Event.cc.

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

Referenced by getLuminosityBlock(), and getRun().

303  {
304  Long_t eventIndex = branchMap_.getEventEntry();
305  updateAux(eventIndex);
306  return aux_;
307 }
Long_t getEventEntry() const
void updateAux(Long_t eventIndex) const
Definition: Event.cc:310
fwlite::BranchMapReader branchMap_
Definition: Event.h:184
edm::EventAuxiliary aux_
Definition: Event.h:191
void Event::fillParameterSetRegistry ( ) const
private

Definition at line 409 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(), edm::ParameterSet::setID(), and edm::FileFormatVersion::triggerPathsTracked().

Referenced by triggerNames(), and triggerResultsByName().

409  {
410  if (parameterSetRegistryFilled_) return;
412 
413  TTree* meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
414  if (0 == meta) {
415  throw cms::Exception("NoMetaTree") << "The TFile does not contain a TTree named "
417  }
418 
419  edm::FileFormatVersion fileFormatVersion;
420  edm::FileFormatVersion *fftPtr = &fileFormatVersion;
421  if(meta->FindBranch(edm::poolNames::fileFormatVersionBranchName().c_str()) != 0) {
422  TBranch *fft = meta->GetBranch(edm::poolNames::fileFormatVersionBranchName().c_str());
423  fft->SetAddress(&fftPtr);
424  fft->GetEntry(0);
425  }
426 
427  typedef std::map<edm::ParameterSetID, edm::ParameterSetBlob> PsetMap;
428  PsetMap psetMap;
429  TTree* psetTree(0);
430  if (meta->FindBranch(edm::poolNames::parameterSetMapBranchName().c_str()) != 0) {
431  PsetMap *psetMapPtr = &psetMap;
432  TBranch* b = meta->GetBranch(edm::poolNames::parameterSetMapBranchName().c_str());
433  b->SetAddress(&psetMapPtr);
434  b->GetEntry(0);
435  } else if(0 == (psetTree = dynamic_cast<TTree *>(branchMap_.getFile()->Get(edm::poolNames::parameterSetsTreeName().c_str())))) {
436  throw cms::Exception("NoParameterSetMapTree")
437  << "The TTree "
438  << edm::poolNames::parameterSetsTreeName() << " could not be found in the file.";
439  } else {
440  typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
441  IdToBlobs idToBlob;
442  IdToBlobs* pIdToBlob = &idToBlob;
443  psetTree->SetBranchAddress(edm::poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
444  for(long long i = 0; i != psetTree->GetEntries(); ++i) {
445  psetTree->GetEntry(i);
446  psetMap.insert(idToBlob);
447  }
448  }
450  if(!fileFormatVersion.triggerPathsTracked()) {
451  edm::ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion.parameterSetsByReference());
452  } else {
453  // Merge into the parameter set registry.
455  for(PsetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end();
456  i != iEnd; ++i) {
457  edm::ParameterSet pset(i->second.pset());
458  pset.setID(i->first);
459  psetRegistry.insertMapped(pset);
460  }
461  }
462 }
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:249
int i
Definition: DBlmapReader.cc:9
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:212
static ThreadSafeRegistry * instance()
TFile * getFile() const
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:245
void setID(ParameterSetID const &id) const
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)
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 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: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 276 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:199
Long_t getEventEntry() const
virtual bool atEnd() const
Definition: Event.cc:248
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 290 of file Event.cc.

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

294  {
295  if(atEnd()) {
296  throw cms::Exception("OffEnd") << "You have requested data past the last event";
297  }
298  Long_t eventIndex = branchMap_.getEventEntry();
299  return dataHelper_.getByLabel(iInfo, iModuleLabel, iProductInstanceLabel, iProcessLabel, holder, eventIndex);
300 }
fwlite::DataGetterHelper dataHelper_
Definition: Event.h:199
Long_t getEventEntry() const
virtual bool atEnd() const
Definition: Event.cc:248
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 386 of file Event.cc.

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

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

386  {
387  Long_t eventIndex = branchMap_.getEventEntry();
388  return dataHelper_.getByProductID(iID, eventIndex);
389 }
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 493 of file Event.cc.

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

Referenced by main().

493  {
494  if (not lumi_) {
495  // Branch map pointer not really being shared, owned by event, have to trick Lumi
496  lumi_ = boost::shared_ptr<fwlite::LuminosityBlock> (
497  new fwlite::LuminosityBlock(boost::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()),
498  runFactory_)
499  );
500  }
503  lumi_->to(run, lumi);
504  return *lumi_;
505 }
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:303
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 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:190
edm::ProcessHistory const & history() const
Definition: Event.cc:321
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 507 of file Event.cc.

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

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

507  {
508  run_ = runFactory_->makeRun(boost::shared_ptr<BranchMapReader>(&branchMap_,NoDelete()));
510  run_->to(run);
511  return *run_;
512 }
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:303
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 321 of file Event.cc.

References aux_, b, branchMap_, alignCSCRings::e, 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().

321  {
322  edm::ProcessHistoryID processHistoryID;
323 
324  bool newFormat = (fileVersion_ >= 5);
325 
326  Long_t eventIndex = branchMap_.getEventEntry();
327  updateAux(eventIndex);
328  if (!newFormat) {
329  processHistoryID = aux_.processHistoryID();
330  }
331  if(historyMap_.empty() || newFormat) {
332  procHistoryNames_.clear();
333  TTree *meta = dynamic_cast<TTree*>(branchMap_.getFile()->Get(edm::poolNames::metaDataTreeName().c_str()));
334  if(0 == meta) {
335  throw cms::Exception("NoMetaTree") << "The TFile does not appear to contain a TTree named "
337  }
338  if (historyMap_.empty()) {
339  if (fileVersion_ < 11) {
341  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryMapBranchName().c_str());
342  b->SetAddress(&pPhm);
343  b->GetEntry(0);
344  } else {
345  edm::ProcessHistoryVector historyVector;
346  edm::ProcessHistoryVector* pPhv = &historyVector;
347  TBranch* b = meta->GetBranch(edm::poolNames::processHistoryBranchName().c_str());
348  b->SetAddress(&pPhv);
349  b->GetEntry(0);
350  for (edm::ProcessHistoryVector::const_iterator i = historyVector.begin(), e = historyVector.end();
351  i != e; ++i) {
352  historyMap_.insert(std::make_pair(i->id(), *i));
353  }
354  }
355  }
356  if (newFormat) {
357  if (fileVersion_ >= 17) {
358  processHistoryID = aux_.processHistoryID();
359  } else if (fileVersion_ >= 7) {
361  edm::History* pHistory = &history;
362  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
363  if (!eventHistoryBranch)
365  << "Failed to find history branch in event history tree";
366  eventHistoryBranch->SetAddress(&pHistory);
367  eventHistoryTree_->GetEntry(eventIndex);
368  processHistoryID = history.processHistoryID();
369  } else {
370  std::vector<edm::EventProcessHistoryID> *pEventProcessHistoryIDs = &eventProcessHistoryIDs_;
371  TBranch* b = meta->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
372  b->SetAddress(&pEventProcessHistoryIDs);
373  b->GetEntry(0);
375  processHistoryID = std::lower_bound(eventProcessHistoryIDs_.begin(), eventProcessHistoryIDs_.end(), target)->processHistoryID();
376  }
377  }
378 
379  }
380 
381  return historyMap_[processHistoryID];
382 }
edm::ProcessHistoryMap historyMap_
Definition: Event.h:188
int i
Definition: DBlmapReader.cc:9
ProcessHistoryRegistry::collection_type ProcessHistoryMap
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:310
ProcessHistoryRegistry::vector_type ProcessHistoryVector
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:321
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
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: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
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:184
EntryFinder entryFinder_
Definition: Event.h:192
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:184
Event::operator bool ( ) const

Definition at line 243 of file Event.cc.

243  {
244  return isValid();
245 }
bool isValid() const
Definition: Event.cc:237
Event const & 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: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:321
Long64_t Event::scan ( char const *  varexp = "",
char const *  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: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 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:184
void Event::throwProductNotFoundException ( std::type_info const &  iType,
char const *  iModule,
char const *  iProduct,
char const *  iProcess 
)
static

Definition at line 485 of file Event.cc.

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

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

485  {
486  edm::TypeID type(iType);
487  throw edm::Exception(edm::errors::ProductNotFound) << "A branch was found for \n type ='" << type.className() << "'\n module='" << iModule
488  << "'\n productInstance='" << ((0!=iProduct)?iProduct:"") << "'\n process='" << ((0 != iProcess) ? iProcess : "") << "'\n"
489  "but no data is available for this Event";
490 }
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:184
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: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
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:184
EntryFinder entryFinder_
Definition: Event.h:192
Event const & 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:184
edm::TriggerNames const & Event::triggerNames ( edm::TriggerResults const &  triggerResults) const
virtual

Implements edm::EventBase.

Definition at line 393 of file Event.cc.

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

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

393  {
395  if (names != 0) return *names;
396 
399  names = triggerNames_(triggerResults);
400  }
401  if (names != 0) return *names;
402 
403  throw cms::Exception("TriggerNamesNotFound")
404  << "TriggerNames not found in ParameterSet registry";
405  return *names;
406 }
static const HistoName names[]
bool parameterSetRegistryFilled_
Definition: Event.h:197
static TriggerNames const * triggerNames_(edm::TriggerResults const &triggerResults)
Definition: EventBase.cc:42
void fillParameterSetRegistry() const
Definition: Event.cc:409
edm::TriggerResultsByName Event::triggerResultsByName ( std::string const &  process) const
virtual

Implements edm::EventBase.

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

465  {
466 
467  fwlite::Handle<edm::TriggerResults> hTriggerResults;
468  hTriggerResults.getByLabel(*this, "TriggerResults", "", process.c_str());
469  if (!hTriggerResults.isValid()) {
470  return edm::TriggerResultsByName(0,0);
471  }
472 
473  edm::TriggerNames const* names = triggerNames_(*hTriggerResults);
474  if (names == 0 && !parameterSetRegistryFilled_) {
476  names = triggerNames_(*hTriggerResults);
477  }
478  return edm::TriggerResultsByName(hTriggerResults.product(), names);
479 }
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:409
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 310 of file Event.cc.

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

Referenced by eventAuxiliary(), and history().

310  {
311  if(auxBranch_->GetEntryNumber() != eventIndex) {
312  auxBranch_->GetEntry(eventIndex);
313  //handling dealing with old version
314  if(0 != pOldAux_) {
316  }
317  }
318 }
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().