CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
fwlite::internal::BranchMapReaderStrategyV11 Class Reference
Inheritance diagram for fwlite::internal::BranchMapReaderStrategyV11:
fwlite::internal::Strategy fwlite::internal::BMRStrategy

Public Member Functions

edm::BranchListIndexes const & branchListIndexes () const override
 
 BranchMapReaderStrategyV11 (TFile *file, int fileVersion)
 
edm::BranchID productToBranchID (edm::ProductID const &pid) override
 
bool updateEvent (Long_t eventEntry) override
 
bool updateFile (TFile *file) override
 
bool updateLuminosityBlock (Long_t luminosityBlockEntry) override
 
bool updateMap () override
 
bool updateRun (Long_t runEntry) override
 
- Public Member Functions inherited from fwlite::internal::Strategy
edm::BranchDescription const & branchIDToBranch (edm::BranchID const &bid) const override
 
std::vector< edm::BranchDescription > const & getBranchDescriptions () override
 
TBranch * getBranchRegistry (edm::ProductRegistry **pReg)
 
edm::BranchDescription const & productToBranch (edm::ProductID const &pid) override
 
edm::BranchID productToBranchID (edm::ProductID const &pid) override
 
 Strategy (TFile *file, int fileVersion)
 
edm::ThinnedAssociationsHelper const & thinnedAssociationsHelper () const override
 
 ~Strategy () override
 
- Public Member Functions inherited from fwlite::internal::BMRStrategy
 BMRStrategy (TFile *file, int fileVersion)
 
virtual const edm::BranchDescriptionbranchIDToBranch (const edm::BranchID &bid) const =0
 
virtual const edm::BranchDescriptionproductToBranch (const edm::ProductID &pid)=0
 
virtual edm::BranchID productToBranchID (const edm::ProductID &pid)=0
 
virtual ~BMRStrategy ()
 

Private Attributes

edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
 
edm::propagate_const< TTree * > eventHistoryTree_
 
edm::History history_
 
edm::History const * pHistory_
 

Additional Inherited Members

- Public Types inherited from fwlite::internal::Strategy
typedef std::map< edm::BranchID, edm::BranchDescriptionbidToDesc
 
- Public Attributes inherited from fwlite::internal::Strategy
std::vector< edm::BranchDescriptionbDesc_
 
bidToDesc branchDescriptionMap_
 
bool mapperFilled_
 
edm::propagate_const< std::unique_ptr< edm::ThinnedAssociationsHelper > > thinnedAssociationsHelper_
 
- Public Attributes inherited from fwlite::internal::BMRStrategy
edm::propagate_const< TFile * > currentFile_
 
Long_t eventEntry_
 
edm::propagate_const< TTree * > eventTree_
 
TUUID fileUUID_
 
int fileVersion_
 
Long_t luminosityBlockEntry_
 
edm::propagate_const< TTree * > luminosityBlockTree_
 
Long_t runEntry_
 
edm::propagate_const< TTree * > runTree_
 

Detailed Description

Definition at line 316 of file BranchMapReader.cc.

Constructor & Destructor Documentation

fwlite::internal::BranchMapReaderStrategyV11::BranchMapReaderStrategyV11 ( TFile *  file,
int  fileVersion 
)

Member Function Documentation

edm::BranchListIndexes const& fwlite::internal::BranchMapReaderStrategyV11::branchListIndexes ( ) const
inlineoverridevirtual

Implements fwlite::internal::BMRStrategy.

Definition at line 325 of file BranchMapReader.cc.

325 {return history_.branchListIndexes();}
BranchListIndexes const & branchListIndexes() const
Definition: History.h:50
edm::BranchID fwlite::internal::BranchMapReaderStrategyV11::productToBranchID ( edm::ProductID const &  pid)
override

Definition at line 428 of file BranchMapReader.cc.

References branchIDLists_, edm::History::branchListIndexes(), history_, edm::productIDToBranchID(), and updateMap().

428  {
429  updateMap();
431  }
edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
BranchListIndexes const & branchListIndexes() const
Definition: History.h:50
bool fwlite::internal::BranchMapReaderStrategyV11::updateEvent ( Long_t  eventEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 338 of file BranchMapReader.cc.

References fwlite::internal::BMRStrategy::eventEntry_, and fwlite::internal::Strategy::mapperFilled_.

338  {
339 // std::cout << "v11 updateevent " << newevent << std::endl;
340  if(newevent != eventEntry_) {
341  eventEntry_ = newevent;
342  mapperFilled_ = false;
343  }
344  return true;
345  }
bool fwlite::internal::BranchMapReaderStrategyV11::updateFile ( TFile *  file)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 363 of file BranchMapReader.cc.

References b, fwlite::internal::Strategy::bDesc_, beamvalidation::br, fwlite::internal::Strategy::branchDescriptionMap_, edm::BranchDescription::branchID(), edm::poolNames::branchIDListBranchName(), branchIDLists_, edm::BranchDescription::branchType(), fwlite::internal::BMRStrategy::currentFile_, edm::errors::EventCorruption, eventHistoryTree_, edm::poolNames::eventHistoryTreeName(), Exception, edm::propagate_const< T >::get(), fwlite::internal::Strategy::getBranchRegistry(), edm::InEvent, edm::BranchDescription::init(), fwlite::internal::Strategy::mapperFilled_, edm::poolNames::metaDataTreeName(), parseEventContent::prod, edm::ProductRegistry::productListUpdator(), edm::ProductRegistry::setFrozen(), and fwlite::internal::Strategy::updateFile().

Referenced by BranchMapReaderStrategyV11().

363  {
365  mapperFilled_ = false;
366  TTree* metaDataTree = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
367 
368  if(nullptr == metaDataTree) {
370  <<"No "<<edm::poolNames::metaDataTreeName()<<" TTree in file";
371  }
372  branchIDLists_ = std::make_unique<edm::BranchIDLists>();
373  edm::BranchIDLists* branchIDListsPtr = branchIDLists_.get();
374  if(metaDataTree->FindBranch(edm::poolNames::branchIDListBranchName().c_str()) != nullptr) {
375  TBranch* b = metaDataTree->GetBranch(edm::poolNames::branchIDListBranchName().c_str());
376  b->SetAddress(&branchIDListsPtr);
377  b->GetEntry(0);
378 // std::cout << "--> " << branchIDLists_->size() << std::endl;
379  } else {
381  << "FindBranch of branchIDList failed";
382  return false;
383  }
384 
385  eventHistoryTree_ = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::eventHistoryTreeName().c_str()));
386 
387  branchDescriptionMap_.clear();
388  bDesc_.clear();
389 
391  edm::ProductRegistry* pReg = &reg;
392  TBranch *br = getBranchRegistry(&pReg);
393 
394  if(nullptr != br) {
396 
397  for(auto& item : prodList) {
398  edm::BranchDescription& prod = item.second;
399  if(edm::InEvent == prod.branchType()) {
400  // call to regenerate branchName
401  prod.init();
403 // std::cout << "v11 updatefile " << prod.branchID() << std::endl;
404  }
405  }
406  }
407  reg.setFrozen(false);
408  return nullptr != br;
409  }
BranchType const & branchType() const
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
edm::propagate_const< TFile * > currentFile_
std::map< BranchKey, BranchDescription > ProductList
bool updateFile(TFile *file) override
edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
std::vector< edm::BranchDescription > bDesc_
edm::propagate_const< TTree * > eventHistoryTree_
TBranch * getBranchRegistry(edm::ProductRegistry **pReg)
BranchID const & branchID() const
std::string const & metaDataTreeName()
Definition: BranchType.cc:168
void setFrozen(bool initializeLookupInfo=true)
element_type const * get() const
double b
Definition: hdecay.h:120
ProductList & productListUpdator()
std::string const & branchIDListBranchName()
Definition: BranchType.cc:208
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:268
bool fwlite::internal::BranchMapReaderStrategyV11::updateLuminosityBlock ( Long_t  luminosityBlockEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 347 of file BranchMapReader.cc.

References fwlite::internal::BMRStrategy::luminosityBlockEntry_, and fwlite::internal::Strategy::mapperFilled_.

347  {
348  if(newlumi != luminosityBlockEntry_) {
349  luminosityBlockEntry_ = newlumi;
350  mapperFilled_ = false;
351  }
352  return true;
353  }
bool fwlite::internal::BranchMapReaderStrategyV11::updateMap ( )
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 411 of file BranchMapReader.cc.

References edm::errors::EventCorruption, fwlite::internal::BMRStrategy::eventEntry_, edm::poolNames::eventHistoryBranchName(), eventHistoryTree_, Exception, fwlite::internal::Strategy::mapperFilled_, and pHistory_.

Referenced by productToBranchID().

411  {
412  if(!mapperFilled_) {
413  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
414  if(!eventHistoryBranch) {
416  << "Failed to find history branch in event history tree";
417  return false;
418  }
419  // yes, SetAddress really does need to be called every time...
420  eventHistoryBranch->SetAddress(&pHistory_);
421  eventHistoryTree_->GetEntry(eventEntry_);
422  mapperFilled_ = true;
423  }
424  return true;
425  }
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:238
edm::propagate_const< TTree * > eventHistoryTree_
bool fwlite::internal::BranchMapReaderStrategyV11::updateRun ( Long_t  runEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 355 of file BranchMapReader.cc.

References fwlite::internal::Strategy::mapperFilled_, and fwlite::internal::BMRStrategy::runEntry_.

355  {
356  if(newRun != runEntry_) {
357  runEntry_ = newRun;
358  mapperFilled_ = false;
359  }
360  return true;
361  }

Member Data Documentation

edm::propagate_const<std::unique_ptr<edm::BranchIDLists> > fwlite::internal::BranchMapReaderStrategyV11::branchIDLists_
private

Definition at line 327 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

edm::propagate_const<TTree*> fwlite::internal::BranchMapReaderStrategyV11::eventHistoryTree_
private

Definition at line 328 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

edm::History fwlite::internal::BranchMapReaderStrategyV11::history_
private

Definition at line 329 of file BranchMapReader.cc.

Referenced by productToBranchID().

edm::History const* fwlite::internal::BranchMapReaderStrategyV11::pHistory_
private

Definition at line 330 of file BranchMapReader.cc.

Referenced by updateMap().