CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Private Attributes

std::auto_ptr< edm::BranchIDListsbranchIDLists_
 
TTree * eventHistoryTree_
 
edm::History history_
 
edm::HistorypHistory_
 

Additional Inherited Members

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

Detailed Description

Definition at line 299 of file BranchMapReader.cc.

Constructor & Destructor Documentation

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

Member Function Documentation

virtual edm::BranchListIndexes const& fwlite::internal::BranchMapReaderStrategyV11::branchListIndexes ( ) const
inlinevirtual

Implements fwlite::internal::BMRStrategy.

Definition at line 308 of file BranchMapReader.cc.

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

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

Reimplemented from fwlite::internal::Strategy.

Definition at line 409 of file BranchMapReader.cc.

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

409  {
410  updateMap();
412  }
BranchID productIDToBranchID(ProductID const &pid, BranchIDLists const &lists, BranchListIndexes const &indexes)
std::auto_ptr< edm::BranchIDLists > branchIDLists_
BranchListIndexes const & branchListIndexes() const
Definition: History.h:50
bool fwlite::internal::BranchMapReaderStrategyV11::updateEvent ( Long_t  eventEntry)
virtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 321 of file BranchMapReader.cc.

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

321  {
322 // std::cout << "v11 updateevent " << newevent << std::endl;
323  if(newevent != eventEntry_) {
324  eventEntry_ = newevent;
325  mapperFilled_ = false;
326  }
327  return true;
328  }
bool fwlite::internal::BranchMapReaderStrategyV11::updateFile ( TFile *  file)
virtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 346 of file BranchMapReader.cc.

References b, fwlite::internal::Strategy::bDesc_, scaleCards::br, fwlite::internal::Strategy::branchDescriptionMap_, edm::poolNames::branchIDListBranchName(), branchIDLists_, fwlite::internal::BMRStrategy::currentFile_, edm::errors::EventCorruption, eventHistoryTree_, edm::poolNames::eventHistoryTreeName(), edm::hlt::Exception, fwlite::internal::Strategy::getBranchRegistry(), edm::InEvent, fwlite::internal::Strategy::mapperFilled_, edm::poolNames::metaDataTreeName(), edm::ProductRegistry::productList(), and fwlite::internal::Strategy::updateFile().

Referenced by BranchMapReaderStrategyV11().

346  {
348  mapperFilled_ = false;
349  TTree* metaDataTree = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::metaDataTreeName().c_str()));
350 
351  if(0 == metaDataTree) {
353  <<"No "<<edm::poolNames::metaDataTreeName()<<" TTree in file";
354  }
356  edm::BranchIDLists* branchIDListsPtr = branchIDLists_.get();
357  if(metaDataTree->FindBranch(edm::poolNames::branchIDListBranchName().c_str()) != 0) {
358  TBranch* b = metaDataTree->GetBranch(edm::poolNames::branchIDListBranchName().c_str());
359  b->SetAddress(&branchIDListsPtr);
360  b->GetEntry(0);
361 // std::cout << "--> " << branchIDLists_->size() << std::endl;
362  } else {
364  << "FindBranch of branchIDList failed";
365  return false;
366  }
367 
368  eventHistoryTree_ = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::eventHistoryTreeName().c_str()));
369 
370  branchDescriptionMap_.clear();
371  bDesc_.clear();
372 
374  edm::ProductRegistry* pReg = &reg;
375  TBranch *br = getBranchRegistry(&pReg);
376 
377  if(0 != br) {
378  edm::ProductRegistry::ProductList const& prodList = reg.productList();
379 
380  for(edm::ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd; ++it) {
381  if(edm::InEvent == it->second.branchType()) {
382  // call to regenerate branchName
383  it->second.init();
384  branchDescriptionMap_.insert(bidToDesc::value_type(it->second.branchID(), it->second));
385 // std::cout << "v11 updatefile " << it->second.branchID() << std::endl;
386  }
387  }
388  }
389  return 0 != br;
390  }
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
std::map< BranchKey, BranchDescription > ProductList
std::vector< edm::BranchDescription > bDesc_
ProductList const & productList() const
std::auto_ptr< edm::BranchIDLists > branchIDLists_
tuple br
Definition: scaleCards.py:54
TBranch * getBranchRegistry(edm::ProductRegistry **pReg)
std::string const & metaDataTreeName()
Definition: BranchType.cc:167
Container::value_type value_type
double b
Definition: hdecay.h:120
virtual bool updateFile(TFile *file)
author Stefano ARGIRO author Bill Tanenbaum
std::string const & branchIDListBranchName()
Definition: BranchType.cc:207
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:262
bool fwlite::internal::BranchMapReaderStrategyV11::updateLuminosityBlock ( Long_t  luminosityBlockEntry)
virtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 330 of file BranchMapReader.cc.

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

330  {
331  if(newlumi != luminosityBlockEntry_) {
332  luminosityBlockEntry_ = newlumi;
333  mapperFilled_ = false;
334  }
335  return true;
336  }
bool fwlite::internal::BranchMapReaderStrategyV11::updateMap ( )
virtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 392 of file BranchMapReader.cc.

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

Referenced by productToBranchID().

392  {
393  if(!mapperFilled_) {
394  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
395  if(!eventHistoryBranch) {
397  << "Failed to find history branch in event history tree";
398  return false;
399  }
400  // yes, SetAddress really does need to be called every time...
401  eventHistoryBranch->SetAddress(&pHistory_);
402  eventHistoryTree_->GetEntry(eventEntry_);
403  mapperFilled_ = true;
404  }
405  return true;
406  }
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:232
bool fwlite::internal::BranchMapReaderStrategyV11::updateRun ( Long_t  runEntry)
virtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 338 of file BranchMapReader.cc.

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

338  {
339  if(newRun != runEntry_) {
340  runEntry_ = newRun;
341  mapperFilled_ = false;
342  }
343  return true;
344  }

Member Data Documentation

std::auto_ptr<edm::BranchIDLists> fwlite::internal::BranchMapReaderStrategyV11::branchIDLists_
private

Definition at line 310 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

TTree* fwlite::internal::BranchMapReaderStrategyV11::eventHistoryTree_
private

Definition at line 311 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

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

Definition at line 312 of file BranchMapReader.cc.

Referenced by branchListIndexes(), and productToBranchID().

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

Definition at line 313 of file BranchMapReader.cc.

Referenced by updateMap().