CMS 3D CMS Logo

Public Member Functions | Private Attributes

fwlite::internal::BranchMapReaderStrategyV17 Class Reference

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

List of all members.

Public Member Functions

 BranchMapReaderStrategyV17 (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_
edm::BranchListIndexes branchListIndexes_
TTree * eventsTree_
edm::BranchListIndexespBranchListIndexes_

Detailed Description

Definition at line 406 of file BranchMapReader.cc.


Constructor & Destructor Documentation

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

Definition at line 422 of file BranchMapReader.cc.

References updateFile().


Member Function Documentation

edm::BranchID fwlite::internal::BranchMapReaderStrategyV17::productToBranchID ( edm::ProductID const &  pid) [virtual]
bool fwlite::internal::BranchMapReaderStrategyV17::updateEvent ( Long_t  eventEntry) [virtual]

Reimplemented from fwlite::internal::Strategy.

Definition at line 427 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::BranchMapReaderStrategyV17::updateFile ( TFile *  file) [virtual]

Reimplemented from fwlite::internal::Strategy.

Definition at line 452 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, eventsTree_, edm::poolNames::eventTreeName(), Exception, fwlite::internal::Strategy::getBranchRegistry(), edm::InEvent, fwlite::internal::Strategy::mapperFilled_, edm::poolNames::metaDataTreeName(), and edm::ProductRegistry::productList().

Referenced by BranchMapReaderStrategyV17().

                                                           {
      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;
      }

      eventsTree_ = dynamic_cast<TTree*>(currentFile_->Get(edm::poolNames::eventTreeName().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::BranchMapReaderStrategyV17::updateLuminosityBlock ( Long_t  luminosityBlockEntry) [virtual]

Reimplemented from fwlite::internal::Strategy.

Definition at line 436 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::BranchMapReaderStrategyV17::updateMap ( ) [virtual]

Reimplemented from fwlite::internal::Strategy.

Definition at line 496 of file BranchMapReader.cc.

References edm::poolNames::branchListIndexesBranchName(), edm::errors::EventCorruption, fwlite::internal::BMRStrategy::eventEntry_, eventsTree_, Exception, fwlite::internal::Strategy::mapperFilled_, and pBranchListIndexes_.

Referenced by productToBranchID().

                                               {
      if(!mapperFilled_) {
        TBranch* branchListIndexesBranch = eventsTree_->GetBranch(edm::poolNames::branchListIndexesBranchName().c_str());
        if(!branchListIndexesBranch) {
          throw edm::Exception(edm::errors::EventCorruption)
            << "Failed to find branch list indexes branch in event tree";
          return false;
        }
        // yes, SetAddress really does need to be called every time...
        branchListIndexesBranch->SetAddress(&pBranchListIndexes_);
        branchListIndexesBranch->GetEntry(eventEntry_);
        mapperFilled_ = true;
      }
      return true;
    }
bool fwlite::internal::BranchMapReaderStrategyV17::updateRun ( Long_t  runEntry) [virtual]

Reimplemented from fwlite::internal::Strategy.

Definition at line 444 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 416 of file BranchMapReader.cc.

Referenced by productToBranchID(), and updateFile().

Definition at line 418 of file BranchMapReader.cc.

Referenced by productToBranchID().

Definition at line 417 of file BranchMapReader.cc.

Referenced by updateFile(), and updateMap().

Definition at line 419 of file BranchMapReader.cc.

Referenced by updateMap().