CMS 3D CMS Logo

Public Member Functions | Private Attributes

fwlite::internal::BranchMapReaderStrategyV11 Class Reference

Inheritance diagram for fwlite::internal::BranchMapReaderStrategyV11:
fwlite::internal::Strategy fwlite::internal::BMRStrategy

List of all members.

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)

Private Attributes

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

Detailed Description

Definition at line 299 of file BranchMapReader.cc.


Constructor & Destructor Documentation

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

Definition at line 316 of file BranchMapReader.cc.

References updateFile().


Member Function Documentation

virtual edm::BranchListIndexes const& fwlite::internal::BranchMapReaderStrategyV11::branchListIndexes ( ) const [inline, virtual]
edm::BranchID fwlite::internal::BranchMapReaderStrategyV11::productToBranchID ( edm::ProductID const &  pid) [virtual]
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_.

                                                                {
//      std::cout << "v11 updateevent " << newevent << std::endl;
      if(newevent != eventEntry_) {
        eventEntry_ = newevent;
        mapperFilled_ = false;
      }
      return true;
    }
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_, beamvalidation::br, fwlite::internal::Strategy::branchDescriptionMap_, edm::poolNames::branchIDListBranchName(), branchIDLists_, fwlite::internal::BMRStrategy::currentFile_, edm::errors::EventCorruption, eventHistoryTree_, edm::poolNames::eventHistoryTreeName(), Exception, fwlite::internal::Strategy::getBranchRegistry(), edm::InEvent, fwlite::internal::Strategy::mapperFilled_, edm::poolNames::metaDataTreeName(), and edm::ProductRegistry::productList().

Referenced by BranchMapReaderStrategyV11().

                                                           {
      Strategy::updateFile(file);
      mapperFilled_ = false;
      TTree* metaDataTree = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::metaDataTreeName().c_str()));

      if(0 == metaDataTree) {
         throw edm::Exception(edm::errors::EventCorruption)
           <<"No "<<edm::poolNames::metaDataTreeName()<<" TTree in file";
      }
      branchIDLists_.reset(new edm::BranchIDLists);
      edm::BranchIDLists* branchIDListsPtr = branchIDLists_.get();
      if(metaDataTree->FindBranch(edm::poolNames::branchIDListBranchName().c_str()) != 0) {
        TBranch* b = metaDataTree->GetBranch(edm::poolNames::branchIDListBranchName().c_str());
        b->SetAddress(&branchIDListsPtr);
        b->GetEntry(0);
//         std::cout << "--> " << branchIDLists_->size() << std::endl;
      } else {
        throw edm::Exception(edm::errors::EventCorruption)
          << "FindBranch of branchIDList failed";
        return false;
      }

      eventHistoryTree_ = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::eventHistoryTreeName().c_str()));

      branchDescriptionMap_.clear();
      bDesc_.clear();

      edm::ProductRegistry reg;
      edm::ProductRegistry* pReg = &reg;
      TBranch *br = getBranchRegistry(&pReg);

      if(0 != br) {
        edm::ProductRegistry::ProductList const& prodList = reg.productList();

        for(edm::ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd; ++it) {
          if(edm::InEvent == it->second.branchType()) {
            // call to regenerate branchName
            it->second.init();
            branchDescriptionMap_.insert(bidToDesc::value_type(it->second.branchID(), it->second));
//             std::cout << "v11 updatefile " << it->second.branchID() << std::endl;
                }
              }
      }
      return 0 != br;
    }
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_.

                                                                         {
      if(newlumi != luminosityBlockEntry_) {
        luminosityBlockEntry_ = newlumi;
        mapperFilled_ = false;
      }
      return true;
    }
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_, Exception, fwlite::internal::Strategy::mapperFilled_, and pHistory_.

Referenced by productToBranchID().

                                               {
      if(!mapperFilled_) {
        TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(edm::poolNames::eventHistoryBranchName().c_str());
        if(!eventHistoryBranch) {
          throw edm::Exception(edm::errors::EventCorruption)
            << "Failed to find history branch in event history tree";
          return false;
        }
        // yes, SetAddress really does need to be called every time...
        eventHistoryBranch->SetAddress(&pHistory_);
        eventHistoryTree_->GetEntry(eventEntry_);
        mapperFilled_ = true;
      }
      return true;
    }
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_.

                                                            {
      if(newRun != runEntry_) {
        runEntry_ = newRun;
        mapperFilled_ = false;
      }
      return true;
    }

Member Data Documentation

Definition at line 310 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

Definition at line 311 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

Definition at line 312 of file BranchMapReader.cc.

Referenced by branchListIndexes(), and productToBranchID().

Definition at line 313 of file BranchMapReader.cc.

Referenced by updateMap().