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

 BranchMapReaderStrategyV11 (TFile *file, int fileVersion)
 
virtual edm::BranchID productToBranchID (const edm::ProductID &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 const std::vector
< edm::BranchDescription > & 
getBranchDescriptions ()
 
TBranch * getBranchRegistry (edm::ProductRegistry **pReg)
 
virtual const
edm::BranchDescription 
productToBranch (const edm::ProductID &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 289 of file BranchMapReader.cc.

Constructor & Destructor Documentation

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

Definition at line 305 of file BranchMapReader.cc.

References updateFile().

Member Function Documentation

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

Reimplemented from fwlite::internal::Strategy.

Definition at line 398 of file BranchMapReader.cc.

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

398  {
399  updateMap();
401  }
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 310 of file BranchMapReader.cc.

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

310  {
311 // std::cout << "v11 updateevent " << newevent << std::endl;
312  if (newevent != eventEntry_) {
313  eventEntry_ = newevent;
314  mapperFilled_ = false;
315  }
316  return true;
317  }
bool fwlite::internal::BranchMapReaderStrategyV11::updateFile ( TFile *  file)
virtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 335 of file BranchMapReader.cc.

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(), 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().

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

Reimplemented from fwlite::internal::Strategy.

Definition at line 319 of file BranchMapReader.cc.

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

319  {
320  if (newlumi != luminosityBlockEntry_) {
321  luminosityBlockEntry_ = newlumi;
322  mapperFilled_ = false;
323  }
324  return true;
325  }
bool fwlite::internal::BranchMapReaderStrategyV11::updateMap ( )
virtual

Reimplemented from fwlite::internal::Strategy.

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

381  {
382  if (!mapperFilled_) {
383  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
384  if (!eventHistoryBranch) {
386  << "Failed to find history branch in event history tree";
387  return false;
388  }
389  // yes, SetAddress really does need to be called every time...
390  eventHistoryBranch->SetAddress(&pHistory_);
391  eventHistoryTree_->GetEntry(eventEntry_);
392  mapperFilled_ = true;
393  }
394  return true;
395  }
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:222
bool fwlite::internal::BranchMapReaderStrategyV11::updateRun ( Long_t  runEntry)
virtual

Reimplemented from fwlite::internal::Strategy.

Definition at line 327 of file BranchMapReader.cc.

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

327  {
328  if (newRun != runEntry_) {
329  runEntry_ = newRun;
330  mapperFilled_ = false;
331  }
332  return true;
333  }

Member Data Documentation

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

Definition at line 299 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

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

Definition at line 300 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

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

Definition at line 301 of file BranchMapReader.cc.

Referenced by productToBranchID().

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

Definition at line 302 of file BranchMapReader.cc.

Referenced by updateMap().