![]() |
![]() |
#include <PoolSource.h>
Public Member Functions | |
PoolSource (ParameterSet const &pset, InputSourceDescription const &desc) | |
virtual | ~PoolSource () |
Static Public Member Functions | |
static void | fillDescriptions (ConfigurationDescriptions &descriptions) |
Private Member Functions | |
virtual void | closeFile_ () |
virtual void | dropUnwantedBranches_ (std::vector< std::string > const &wantedBranches) |
virtual void | endJob () |
virtual ProcessingController::ForwardState | forwardState_ () const |
virtual ItemType | getNextItemType () |
virtual bool | goToEvent_ (EventID const &eventID) |
virtual void | postForkReacquireResources (boost::shared_ptr< edm::multicore::MessageReceiverForSource >) |
virtual void | preForkReleaseResources () |
virtual bool | randomAccess_ () const |
virtual EventPrincipal * | readEvent_ () |
virtual boost::shared_ptr < FileBlock > | readFile_ () |
virtual EventPrincipal * | readIt (EventID const &id) |
virtual boost::shared_ptr < LuminosityBlockPrincipal > | readLuminosityBlock_ (boost::shared_ptr< LuminosityBlockPrincipal > lbCache) |
virtual boost::shared_ptr < LuminosityBlockAuxiliary > | readLuminosityBlockAuxiliary_ () |
virtual void | readMany_ (int number, EventPrincipalVector &result) |
virtual void | readManyRandom_ (int number, EventPrincipalVector &result, unsigned int &fileSeqNumber) |
virtual void | readManySequential_ (int number, EventPrincipalVector &result, unsigned int &fileSeqNumber) |
virtual void | readManySpecified_ (std::vector< EventID > const &events, EventPrincipalVector &result) |
virtual boost::shared_ptr < RunPrincipal > | readRun_ (boost::shared_ptr< RunPrincipal > rpCache) |
virtual boost::shared_ptr < RunAuxiliary > | readRunAuxiliary_ () |
virtual ProcessingController::ReverseState | reverseState_ () const |
virtual void | rewind_ () |
virtual void | skip (int offset) |
Private Attributes | |
boost::array< std::vector < BranchID >, NumBranchTypes > | branchIDsToReplace_ |
unsigned int | numberOfEventsBeforeBigSkip_ |
boost::scoped_ptr < RootInputFileSequence > | primaryFileSequence_ |
boost::shared_ptr < edm::multicore::MessageReceiverForSource > | receiver_ |
RootServiceChecker | rootServiceChecker_ |
boost::scoped_ptr< EventPrincipal > | secondaryEventPrincipal_ |
boost::scoped_ptr < RootInputFileSequence > | secondaryFileSequence_ |
boost::shared_ptr < LuminosityBlockPrincipal > | secondaryLumiPrincipal_ |
boost::shared_ptr< RunPrincipal > | secondaryRunPrincipal_ |
Definition at line 29 of file PoolSource.h.
edm::PoolSource::PoolSource | ( | ParameterSet const & | pset, |
InputSourceDescription const & | desc | ||
) | [explicit] |
Definition at line 53 of file PoolSource.cc.
References begin, relativeConstraints::empty, end, HDQMDatabaseProducer::fullList, i, edm::InEvent, edm::InLumi, edm::InRun, edm::NumBranchTypes, and findQualityFiles::size.
: new RootInputFileSequence(pset, *this, catalog(1), principalCache(), false)), secondaryRunPrincipal_(), secondaryLumiPrincipal_(), secondaryEventPrincipal_(secondaryFileSequence_ ? new EventPrincipal(secondaryFileSequence_->fileProductRegistry(), processConfiguration()) : 0), branchIDsToReplace_(), numberOfEventsBeforeBigSkip_(0) { if (secondaryFileSequence_) { boost::array<std::set<BranchID>, NumBranchTypes> idsToReplace; ProductRegistry::ProductList const& secondary = secondaryFileSequence_->fileProductRegistry()->productList(); ProductRegistry::ProductList const& primary = primaryFileSequence_->fileProductRegistry()->productList(); typedef ProductRegistry::ProductList::const_iterator const_iterator; typedef ProductRegistry::ProductList::iterator iterator; //this is the registry used by the 'outside' world and only has the primary file information in it at present ProductRegistry::ProductList& fullList = productRegistryUpdate().productListUpdator(); for (const_iterator it = secondary.begin(), itEnd = secondary.end(); it != itEnd; ++it) { if (it->second.present()) { idsToReplace[it->second.branchType()].insert(it->second.branchID()); //now make sure this is marked as not dropped else the product will not be 'get'table from the Event iterator itFound = fullList.find(it->first); if(itFound != fullList.end()) { itFound->second.dropped()=false; } } } for (const_iterator it = primary.begin(), itEnd = primary.end(); it != itEnd; ++it) { if (it->second.present()) idsToReplace[it->second.branchType()].erase(it->second.branchID()); } if (idsToReplace[InEvent].empty() && idsToReplace[InLumi].empty() && idsToReplace[InRun].empty()) { secondaryFileSequence_.reset(); } else { for (int i = InEvent; i < NumBranchTypes; ++i) { branchIDsToReplace_[i].reserve(idsToReplace[i].size()); for (std::set<BranchID>::const_iterator it = idsToReplace[i].begin(), itEnd = idsToReplace[i].end(); it != itEnd; ++it) { branchIDsToReplace_[i].push_back(*it); } } } } }
edm::PoolSource::~PoolSource | ( | ) | [virtual] |
Definition at line 101 of file PoolSource.cc.
void edm::PoolSource::closeFile_ | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 118 of file PoolSource.cc.
void edm::PoolSource::dropUnwantedBranches_ | ( | std::vector< std::string > const & | wantedBranches | ) | [private, virtual] |
Implements edm::VectorInputSource.
Definition at line 291 of file PoolSource.cc.
void edm::PoolSource::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 104 of file PoolSource.cc.
void edm::PoolSource::fillDescriptions | ( | ConfigurationDescriptions & | descriptions | ) | [static] |
Reimplemented from edm::InputSource.
Definition at line 297 of file PoolSource.cc.
ProcessingController::ForwardState edm::PoolSource::forwardState_ | ( | ) | const [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 314 of file PoolSource.cc.
InputSource::ItemType edm::PoolSource::getNextItemType | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 210 of file PoolSource.cc.
References edm::InputSource::decreaseRemainingEventsBy(), edm::InputSource::IsStop, numberOfEventsBeforeBigSkip_, primaryFileSequence_, edm::InputSource::principalCache(), receiver_, and edm::InputSource::remainingEvents().
{ receiver_->receive(); unsigned long toSkip = receiver_->numberToSkip(); if (0 != toSkip) { primaryFileSequence_->skipEvents(toSkip, principalCache()); decreaseRemainingEventsBy(toSkip); } numberOfEventsBeforeBigSkip_ = receiver_->numberOfConsecutiveIndices(); if (0 == numberOfEventsBeforeBigSkip_ or 0==remainingEvents()) { return IsStop; } } return primaryFileSequence_->getNextItemType();; }
bool edm::PoolSource::goToEvent_ | ( | EventID const & | eventID | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 262 of file PoolSource.cc.
void edm::PoolSource::postForkReacquireResources | ( | boost::shared_ptr< edm::multicore::MessageReceiverForSource > | iReceiver | ) | [private, virtual] |
Definition at line 233 of file PoolSource.cc.
void edm::PoolSource::preForkReleaseResources | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 228 of file PoolSource.cc.
bool edm::PoolSource::randomAccess_ | ( | ) | const [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 309 of file PoolSource.cc.
EventPrincipal * edm::PoolSource::readEvent_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 178 of file PoolSource.cc.
{ bool found = secondaryFileSequence_->skipToItem(primaryPrincipal->run(), primaryPrincipal->luminosityBlock(), primaryPrincipal->id().event()); if (found) { EventPrincipal* secondaryPrincipal = secondaryFileSequence_->readEvent(*secondaryEventPrincipal_, secondaryLumiPrincipal_); checkConsistency(*primaryPrincipal, *secondaryPrincipal); checkHistoryConsistency(*primaryPrincipal, *secondaryPrincipal); primaryPrincipal->recombine(*secondaryPrincipal, branchIDsToReplace_[InEvent]); secondaryEventPrincipal_->clearPrincipal(); } else { throw Exception(errors::MismatchedInputFiles, "PoolSource::readEvent_") << primaryPrincipal->id() << " is not found in the secondary input files\n"; } } if(receiver_) { --numberOfEventsBeforeBigSkip_; } return primaryPrincipal; }
boost::shared_ptr< FileBlock > edm::PoolSource::readFile_ | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 110 of file PoolSource.cc.
References edm::FileBlock::HasSecondaryFileSequence.
{ fb->setNotFastClonable(FileBlock::HasSecondaryFileSequence); } return fb; }
EventPrincipal * edm::PoolSource::readIt | ( | EventID const & | id | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 203 of file PoolSource.cc.
boost::shared_ptr< LuminosityBlockPrincipal > edm::PoolSource::readLuminosityBlock_ | ( | boost::shared_ptr< LuminosityBlockPrincipal > | lbCache | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 155 of file PoolSource.cc.
References branchIDsToReplace_, Exception, newFWLiteAna::found, edm::InLumi, edm::errors::MismatchedInputFiles, primaryFileSequence_, edm::InputSource::processConfiguration(), secondaryFileSequence_, secondaryLumiPrincipal_, and secondaryRunPrincipal_.
{ boost::shared_ptr<LuminosityBlockPrincipal> primaryPrincipal = primaryFileSequence_->readLuminosityBlock_(lbCache); bool found = secondaryFileSequence_->skipToItem(primaryPrincipal->run(), primaryPrincipal->luminosityBlock(), 0U); if (found) { boost::shared_ptr<LuminosityBlockAuxiliary> secondaryAuxiliary = secondaryFileSequence_->readLuminosityBlockAuxiliary_(); checkConsistency(primaryPrincipal->aux(), *secondaryAuxiliary); boost::shared_ptr<LuminosityBlockPrincipal> lbp(new LuminosityBlockPrincipal(secondaryAuxiliary, secondaryFileSequence_->fileProductRegistry(), processConfiguration(), secondaryRunPrincipal_)); secondaryLumiPrincipal_ = secondaryFileSequence_->readLuminosityBlock_(lbp); checkHistoryConsistency(*primaryPrincipal, *secondaryLumiPrincipal_); primaryPrincipal->recombine(*secondaryLumiPrincipal_, branchIDsToReplace_[InLumi]); } else { throw Exception(errors::MismatchedInputFiles, "PoolSource::readLuminosityBlock_") << " Run " << primaryPrincipal->run() << " LuminosityBlock " << primaryPrincipal->luminosityBlock() << " is not found in the secondary input files\n"; } return primaryPrincipal; } return primaryFileSequence_->readLuminosityBlock_(lbCache); }
boost::shared_ptr< LuminosityBlockAuxiliary > edm::PoolSource::readLuminosityBlockAuxiliary_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 128 of file PoolSource.cc.
void edm::PoolSource::readMany_ | ( | int | number, |
EventPrincipalVector & | result | ||
) | [private, virtual] |
Implements edm::VectorInputSource.
Definition at line 267 of file PoolSource.cc.
void edm::PoolSource::readManyRandom_ | ( | int | number, |
EventPrincipalVector & | result, | ||
unsigned int & | fileSeqNumber | ||
) | [private, virtual] |
Implements edm::VectorInputSource.
Definition at line 273 of file PoolSource.cc.
void edm::PoolSource::readManySequential_ | ( | int | number, |
EventPrincipalVector & | result, | ||
unsigned int & | fileSeqNumber | ||
) | [private, virtual] |
Implements edm::VectorInputSource.
Definition at line 279 of file PoolSource.cc.
void edm::PoolSource::readManySpecified_ | ( | std::vector< EventID > const & | events, |
EventPrincipalVector & | result | ||
) | [private, virtual] |
Implements edm::VectorInputSource.
Definition at line 285 of file PoolSource.cc.
boost::shared_ptr< RunPrincipal > edm::PoolSource::readRun_ | ( | boost::shared_ptr< RunPrincipal > | rpCache | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 133 of file PoolSource.cc.
References branchIDsToReplace_, Exception, newFWLiteAna::found, edm::InRun, edm::errors::MismatchedInputFiles, primaryFileSequence_, edm::InputSource::processConfiguration(), secondaryFileSequence_, and secondaryRunPrincipal_.
{ boost::shared_ptr<RunPrincipal> primaryPrincipal = primaryFileSequence_->readRun_(rpCache); bool found = secondaryFileSequence_->skipToItem(primaryPrincipal->run(), 0U, 0U); if (found) { boost::shared_ptr<RunAuxiliary> secondaryAuxiliary = secondaryFileSequence_->readRunAuxiliary_(); checkConsistency(primaryPrincipal->aux(), *secondaryAuxiliary); boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(secondaryAuxiliary, secondaryFileSequence_->fileProductRegistry(), processConfiguration())); secondaryRunPrincipal_ = secondaryFileSequence_->readRun_(rp); checkHistoryConsistency(*primaryPrincipal, *secondaryRunPrincipal_); primaryPrincipal->recombine(*secondaryRunPrincipal_, branchIDsToReplace_[InRun]); } else { throw Exception(errors::MismatchedInputFiles, "PoolSource::readRun_") << " Run " << primaryPrincipal->run() << " is not found in the secondary input files\n"; } return primaryPrincipal; } return primaryFileSequence_->readRun_(rpCache); }
boost::shared_ptr< RunAuxiliary > edm::PoolSource::readRunAuxiliary_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 123 of file PoolSource.cc.
ProcessingController::ReverseState edm::PoolSource::reverseState_ | ( | ) | const [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 319 of file PoolSource.cc.
void edm::PoolSource::rewind_ | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 243 of file PoolSource.cc.
References numberOfEventsBeforeBigSkip_, primaryFileSequence_, edm::InputSource::principalCache(), and receiver_.
{ unsigned int numberToSkip = receiver_->numberToSkip(); if(0 != numberToSkip) { primaryFileSequence_->skipEvents(numberToSkip, principalCache()); } numberOfEventsBeforeBigSkip_ = receiver_->numberOfConsecutiveIndices(); } }
void edm::PoolSource::skip | ( | int | offset | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 257 of file PoolSource.cc.
boost::array<std::vector<BranchID>, NumBranchTypes> edm::PoolSource::branchIDsToReplace_ [private] |
Definition at line 68 of file PoolSource.h.
Referenced by readLuminosityBlock_(), and readRun_().
unsigned int edm::PoolSource::numberOfEventsBeforeBigSkip_ [private] |
Definition at line 72 of file PoolSource.h.
Referenced by getNextItemType(), and rewind_().
boost::scoped_ptr<RootInputFileSequence> edm::PoolSource::primaryFileSequence_ [private] |
Definition at line 63 of file PoolSource.h.
Referenced by getNextItemType(), readLuminosityBlock_(), readRun_(), and rewind_().
boost::shared_ptr<edm::multicore::MessageReceiverForSource> edm::PoolSource::receiver_ [private] |
Definition at line 71 of file PoolSource.h.
Referenced by getNextItemType(), and rewind_().
Definition at line 62 of file PoolSource.h.
boost::scoped_ptr<EventPrincipal> edm::PoolSource::secondaryEventPrincipal_ [private] |
Definition at line 67 of file PoolSource.h.
boost::scoped_ptr<RootInputFileSequence> edm::PoolSource::secondaryFileSequence_ [private] |
Definition at line 64 of file PoolSource.h.
Referenced by readLuminosityBlock_(), and readRun_().
boost::shared_ptr<LuminosityBlockPrincipal> edm::PoolSource::secondaryLumiPrincipal_ [private] |
Definition at line 66 of file PoolSource.h.
Referenced by readLuminosityBlock_().
boost::shared_ptr<RunPrincipal> edm::PoolSource::secondaryRunPrincipal_ [private] |
Definition at line 65 of file PoolSource.h.
Referenced by readLuminosityBlock_(), and readRun_().