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

 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)

Private Attributes

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

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]
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_.

                                                                {
//      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 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(), 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) {
        const edm::ProductRegistry::ProductList& 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 319 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 381 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 327 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 299 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

Definition at line 300 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

Definition at line 301 of file BranchMapReader.cc.

Referenced by productToBranchID().

Definition at line 302 of file BranchMapReader.cc.

Referenced by updateMap().