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
 
 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 ~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 325 of file BranchMapReader.cc.

Constructor & Destructor Documentation

◆ BranchMapReaderStrategyV11()

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

Definition at line 343 of file BranchMapReader.cc.

344  : Strategy(file, fileVersion), eventHistoryTree_(nullptr), pHistory_(&history_) {
345  updateFile(file);
346  }

References FrontierConditions_GlobalTag_cff::file, and updateFile().

Member Function Documentation

◆ branchListIndexes()

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

Implements fwlite::internal::BMRStrategy.

Definition at line 334 of file BranchMapReader.cc.

334 { return history_.branchListIndexes(); }

References edm::History::branchListIndexes(), and history_.

◆ productToBranchID()

edm::BranchID fwlite::internal::BranchMapReaderStrategyV11::productToBranchID ( edm::ProductID const &  pid)
overridevirtual

◆ updateEvent()

bool fwlite::internal::BranchMapReaderStrategyV11::updateEvent ( Long_t  eventEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 348 of file BranchMapReader.cc.

348  {
349  // std::cout << "v11 updateevent " << newevent << std::endl;
350  if (newevent != eventEntry_) {
351  eventEntry_ = newevent;
352  mapperFilled_ = false;
353  }
354  return true;
355  }

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

◆ updateFile()

bool fwlite::internal::BranchMapReaderStrategyV11::updateFile ( TFile *  file)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 373 of file BranchMapReader.cc.

373  {
375  mapperFilled_ = false;
376  TTree* metaDataTree = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
377 
378  if (nullptr == metaDataTree) {
380  << "No " << edm::poolNames::metaDataTreeName() << " TTree in file";
381  }
382  branchIDLists_ = std::make_unique<edm::BranchIDLists>();
383  edm::BranchIDLists* branchIDListsPtr = branchIDLists_.get();
384  if (metaDataTree->FindBranch(edm::poolNames::branchIDListBranchName().c_str()) != nullptr) {
385  TBranch* b = metaDataTree->GetBranch(edm::poolNames::branchIDListBranchName().c_str());
386  b->SetAddress(&branchIDListsPtr);
387  b->GetEntry(0);
388  // std::cout << "--> " << branchIDLists_->size() << std::endl;
389  } else {
390  throw edm::Exception(edm::errors::EventCorruption) << "FindBranch of branchIDList failed";
391  return false;
392  }
393 
394  eventHistoryTree_ = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::eventHistoryTreeName().c_str()));
395 
396  branchDescriptionMap_.clear();
397  bDesc_.clear();
398 
400  edm::ProductRegistry* pReg = &reg;
401  TBranch* br = getBranchRegistry(&pReg);
402 
403  if (nullptr != br) {
405 
406  for (auto& item : prodList) {
407  edm::BranchDescription& prod = item.second;
408  if (edm::InEvent == prod.branchType()) {
409  // call to regenerate branchName
410  prod.init();
412  // std::cout << "v11 updatefile " << prod.branchID() << std::endl;
413  }
414  }
415  }
416  reg.setFrozen(false);
417  return nullptr != br;
418  }

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

Referenced by BranchMapReaderStrategyV11().

◆ updateLuminosityBlock()

bool fwlite::internal::BranchMapReaderStrategyV11::updateLuminosityBlock ( Long_t  luminosityBlockEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 357 of file BranchMapReader.cc.

357  {
358  if (newlumi != luminosityBlockEntry_) {
359  luminosityBlockEntry_ = newlumi;
360  mapperFilled_ = false;
361  }
362  return true;
363  }

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

◆ updateMap()

bool fwlite::internal::BranchMapReaderStrategyV11::updateMap ( )
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 420 of file BranchMapReader.cc.

420  {
421  if (!mapperFilled_) {
422  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
423  if (!eventHistoryBranch) {
424  throw edm::Exception(edm::errors::EventCorruption) << "Failed to find history branch in event history tree";
425  return false;
426  }
427  // yes, SetAddress really does need to be called every time...
428  eventHistoryBranch->SetAddress(&pHistory_);
429  eventHistoryTree_->GetEntry(eventEntry_);
430  mapperFilled_ = true;
431  }
432  return true;
433  }

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

Referenced by productToBranchID().

◆ updateRun()

bool fwlite::internal::BranchMapReaderStrategyV11::updateRun ( Long_t  runEntry)
overridevirtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 365 of file BranchMapReader.cc.

365  {
366  if (newRun != runEntry_) {
367  runEntry_ = newRun;
368  mapperFilled_ = false;
369  }
370  return true;
371  }

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

Member Data Documentation

◆ branchIDLists_

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

Definition at line 337 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

◆ eventHistoryTree_

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

Definition at line 338 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

◆ history_

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

Definition at line 339 of file BranchMapReader.cc.

Referenced by branchListIndexes(), and productToBranchID().

◆ pHistory_

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

Definition at line 340 of file BranchMapReader.cc.

Referenced by updateMap().

fwlite::internal::Strategy::updateFile
bool updateFile(TFile *file) override
Definition: BranchMapReader.cc:105
edm::poolNames::branchIDListBranchName
std::string const & branchIDListBranchName()
Definition: BranchType.cc:186
fwlite::internal::BranchMapReaderStrategyV11::branchIDLists_
edm::propagate_const< std::unique_ptr< edm::BranchIDLists > > branchIDLists_
Definition: BranchMapReader.cc:337
fwlite::internal::Strategy::branchDescriptionMap_
bidToDesc branchDescriptionMap_
Definition: BranchMapReader.cc:87
edm::ProductRegistry::setFrozen
void setFrozen(bool initializeLookupInfo=true)
Definition: ProductRegistry.cc:165
fwlite::internal::Strategy::mapperFilled_
bool mapperFilled_
Definition: BranchMapReader.cc:89
fwlite::internal::BranchMapReaderStrategyV11::pHistory_
edm::History const * pHistory_
Definition: BranchMapReader.cc:340
fwlite::internal::Strategy::bDesc_
std::vector< edm::BranchDescription > bDesc_
Definition: BranchMapReader.cc:88
edm::errors::EventCorruption
Definition: EDMException.h:43
fwlite::internal::BranchMapReaderStrategyV11::updateMap
bool updateMap() override
Definition: BranchMapReader.cc:420
fwlite::internal::BMRStrategy::eventEntry_
Long_t eventEntry_
Definition: BranchMapReader.h:63
fwlite::internal::Strategy::Strategy
Strategy(TFile *file, int fileVersion)
Definition: BranchMapReader.cc:93
fwlite::internal::BranchMapReaderStrategyV11::eventHistoryTree_
edm::propagate_const< TTree * > eventHistoryTree_
Definition: BranchMapReader.cc:338
edm::ProductRegistry
Definition: ProductRegistry.h:34
edm::propagate_const::get
element_type const * get() const
Definition: propagate_const.h:64
edm::ProductRegistry::productListUpdator
ProductList & productListUpdator()
Definition: ProductRegistry.h:78
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::InEvent
Definition: BranchType.h:11
b
double b
Definition: hdecay.h:118
edm::BranchIDLists
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
fwlite::internal::BMRStrategy::luminosityBlockEntry_
Long_t luminosityBlockEntry_
Definition: BranchMapReader.h:64
edm::ProductRegistry::ProductList
std::map< BranchKey, BranchDescription > ProductList
Definition: ProductRegistry.h:36
fwlite::internal::BMRStrategy::currentFile_
edm::propagate_const< TFile * > currentFile_
Definition: BranchMapReader.h:58
fwlite::internal::BranchMapReaderStrategyV11::history_
edm::History history_
Definition: BranchMapReader.cc:339
beamvalidation.br
br
Definition: beamvalidation.py:398
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::History::branchListIndexes
BranchListIndexes const & branchListIndexes() const
Definition: History.h:50
fwlite::internal::Strategy::getBranchRegistry
TBranch * getBranchRegistry(edm::ProductRegistry **pReg)
Definition: BranchMapReader.cc:116
edm::poolNames::metaDataTreeName
std::string const & metaDataTreeName()
Definition: BranchType.cc:162
Exception
Definition: hltDiff.cc:246
edm::productIDToBranchID
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
Definition: ProductIDToBranchID.cc:11
edm::BranchDescription
Definition: BranchDescription.h:32
fwlite::internal::BranchMapReaderStrategyV11::updateFile
bool updateFile(TFile *file) override
Definition: BranchMapReader.cc:373
edm::poolNames::eventHistoryTreeName
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:222
fwlite::internal::BMRStrategy::runEntry_
Long_t runEntry_
Definition: BranchMapReader.h:65
edm::poolNames::eventHistoryBranchName
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:207