LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
#include "MixHelper.h"
Public Types | |
enum | Mode { Mode::SEQUENTIAL = 0, Mode::RANDOM_REPLACE, Mode::RANDOM_LIM_REPLACE, Mode::RANDOM_NO_REPLACE, Mode::UKNOWN } |
Public Member Functions | |
MixHelper (fhicl::ParameterSet const &pset, ProducerBase &producesProvider) | |
Mode | readMode () const |
void | registerSecondaryFileNameProvider (ProviderFunc_ func) |
template<class P > | |
void | produces (std::string const &instanceName={}) |
template<class P , BranchType B> | |
void | produces (std::string const &instanceName={}) |
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD > | |
void | declareMixOp (InputTag const &inputTag, MixFunc< PROD, OPROD > mixFunc, bool outputProduct=true) |
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD > | |
void | declareMixOp (InputTag const &inputTag, std::string const &outputInstanceLabel, MixFunc< PROD, OPROD > mixFunc, bool outputProduct=true) |
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, bool(T::*mixfunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &), T &t, bool outputProduct=true) |
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, std::string const &outputInstanceLabel, bool(T::*mixfunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &), T &t, bool outputProduct=true) |
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, bool(T::*mixfunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const, T const &t, bool outputProduct=true) |
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, std::string const &outputInstanceLabel, bool(T::*mixfunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const, T const &t, bool outputProduct=true) |
bool | generateEventSequence (size_t nSecondaries, EntryNumberSequence &enSeq, EventIDSequence &eIDseq) |
void | generateEventAuxiliarySequence (EntryNumberSequence const &, EventAuxiliarySequence &) |
void | mixAndPut (EntryNumberSequence const &enSeq, EventIDSequence const &eIDseq, Event &e) |
void | setEventsToSkipFunction (std::function< size_t()> eventsToSkip) |
template<art::BranchType B, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, bool(T::*mixFunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &), T &t, bool outputProduct) |
template<art::BranchType B, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, std::string const &outputInstanceLabel, bool(T::*mixFunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &), T &t, bool outputProduct) |
template<art::BranchType B, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, bool(T::*mixFunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const, T const &t, bool outputProduct) |
template<art::BranchType B, typename PROD , typename OPROD , typename T > | |
void | declareMixOp (InputTag const &inputTag, std::string const &outputInstanceLabel, bool(T::*mixFunc)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const, T const &t, bool outputProduct) |
Private Types | |
typedef std::function< std::string()> | ProviderFunc_ |
using | MixOpList = std::vector< std::unique_ptr< MixOpBase >> |
Private Member Functions | |
MixHelper (MixHelper const &)=delete | |
MixHelper & | operator= (MixHelper const &)=delete |
Mode | initReadMode_ (std::string const &mode) const |
void | openAndReadMetaData_ (std::string fileName) |
bool | openNextFile_ () |
void | buildProductIDTransMap_ (ProdToProdMapBuilder::ProductIDTransMap &transMap) |
Private Attributes | |
ProducerBase & | producesProvider_ |
std::vector< std::string > const | filenames_ |
bool | compactMissingProducts_ |
ProviderFunc_ | providerFunc_ {} |
MixOpList | mixOps_ {} |
PtrRemapper | ptrRemapper_ {} |
std::vector< std::string >::const_iterator | fileIter_ |
Mode const | readMode_ |
double const | coverageFraction_ |
Long64_t | nEventsReadThisFile_ {} |
Long64_t | nEventsInFile_ {} |
Long64_t | totalEventsRead_ {} |
bool const | canWrapFiles_ |
FileFormatVersion | ffVersion_ {} |
std::unique_ptr< art::BranchIDLists > | branchIDLists_ |
ProdToProdMapBuilder | ptpBuilder_ {} |
std::unique_ptr< CLHEP::RandFlat > | dist_ |
std::function< size_t()> | eventsToSkip_ {} |
EntryNumberSequence | shuffledSequence_ {} |
bool | haveSubRunMixOps_ {false} |
bool | haveRunMixOps_ {false} |
cet::value_ptr< TFile > | currentFile_ {} |
cet::exempt_ptr< TTree > | currentMetaDataTree_ {nullptr} |
std::array< cet::exempt_ptr< TTree >, art::BranchType::NumBranchTypes > | currentDataTrees_ {{nullptr}} |
FileIndex | currentFileIndex_ {} |
std::array< RootBranchInfoList, art::BranchType::NumBranchTypes > | dataBranches_ |
EventIDIndex | eventIDIndex_ {} |
Definition at line 244 of file MixHelper.h.
|
private |
Definition at line 355 of file MixHelper.h.
|
private |
Definition at line 246 of file MixHelper.h.
|
strong |
Enumerator | |
---|---|
SEQUENTIAL | |
RANDOM_REPLACE | |
RANDOM_LIM_REPLACE | |
RANDOM_NO_REPLACE | |
UKNOWN |
Definition at line 249 of file MixHelper.h.
art::MixHelper::MixHelper | ( | fhicl::ParameterSet const & | pset, |
ProducerBase & | producesProvider | ||
) |
Definition at line 119 of file MixHelper.cc.
References canWrapFiles_, compactMissingProducts_, coverageFraction_, dist_, fileIter_, filenames_, initReadMode_(), and readMode_.
|
privatedelete |
|
private |
Definition at line 456 of file MixHelper.cc.
References dataBranches_, art::InEvent, and mixOps_.
Referenced by openAndReadMetaData_().
|
inline |
Definition at line 423 of file MixHelper.h.
References art::InputTag::instance().
void art::MixHelper::declareMixOp | ( | InputTag const & | inputTag, |
std::string const & | outputInstanceLabel, | ||
MixFunc< PROD, OPROD > | mixFunc, | ||
bool | outputProduct = true |
||
) |
Definition at line 433 of file MixHelper.h.
References B, compactMissingProducts_, haveRunMixOps_, haveSubRunMixOps_, art::InRun, art::InSubRun, and mixOps_.
void art::MixHelper::declareMixOp | ( | InputTag const & | inputTag, |
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) | mixfunc, | ||
T & | t, | ||
bool | outputProduct = true |
||
) |
void art::MixHelper::declareMixOp | ( | InputTag const & | inputTag, |
std::string const & | outputInstanceLabel, | ||
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) | mixfunc, | ||
T & | t, | ||
bool | outputProduct = true |
||
) |
void art::MixHelper::declareMixOp | ( | InputTag const & | inputTag, |
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const | mixfunc, | ||
T const & | t, | ||
bool | outputProduct = true |
||
) |
void art::MixHelper::declareMixOp | ( | InputTag const & | inputTag, |
std::string const & | outputInstanceLabel, | ||
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const | mixfunc, | ||
T const & | t, | ||
bool | outputProduct = true |
||
) |
|
inline |
Definition at line 457 of file MixHelper.h.
References art::InputTag::instance().
void art::MixHelper::declareMixOp | ( | InputTag const & | inputTag, |
std::string const & | outputInstanceLabel, | ||
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) | mixFunc, | ||
T & | t, | ||
bool | outputProduct | ||
) |
Definition at line 471 of file MixHelper.h.
|
inline |
Definition at line 492 of file MixHelper.h.
References art::InputTag::instance().
void art::MixHelper::declareMixOp | ( | InputTag const & | inputTag, |
std::string const & | outputInstanceLabel, | ||
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const | mixFunc, | ||
T const & | t, | ||
bool | outputProduct | ||
) |
Definition at line 506 of file MixHelper.h.
void art::MixHelper::generateEventAuxiliarySequence | ( | EntryNumberSequence const & | enseq, |
EventAuxiliarySequence & | auxseq | ||
) |
Definition at line 212 of file MixHelper.cc.
References art::BranchTypeToAuxiliaryBranchName(), currentDataTrees_, art::input::getEntry(), and art::InEvent.
Referenced by art::detail::call_processEventAuxiliaries< T >::operator()().
bool art::MixHelper::generateEventSequence | ( | size_t | nSecondaries, |
EntryNumberSequence & | enSeq, | ||
EventIDSequence & | eIDseq | ||
) |
Definition at line 143 of file MixHelper.cc.
References evd::details::begin(), coverageFraction_, dist_, evd::details::end(), eventIDIndex_, ffVersion_, art::FileFormatVersion::isValid(), art::errors::LogicError, nEventsInFile_, nEventsReadThisFile_, openNextFile_(), RANDOM_LIM_REPLACE, RANDOM_NO_REPLACE, RANDOM_REPLACE, readMode_, SEQUENTIAL, and shuffledSequence_.
Referenced by art::MixFilter< T >::filter().
|
private |
Definition at line 316 of file MixHelper.cc.
References art::errors::Configuration.
Referenced by MixHelper().
void art::MixHelper::mixAndPut | ( | EntryNumberSequence const & | enSeq, |
EventIDSequence const & | eIDseq, | ||
Event & | e | ||
) |
Definition at line 240 of file MixHelper.cc.
References branchIDLists_, art::FileIndex::cend(), currentFile_, currentFileIndex_, art::FileIndex::findPosition(), haveRunMixOps_, haveSubRunMixOps_, art::InEvent, art::InRun, art::InSubRun, art::errors::LogicError, mixOps_, nEventsReadThisFile_, art::errors::NotFound, art::ProdToProdMapBuilder::populateRemapper(), ptpBuilder_, ptrRemapper_, and totalEventsRead_.
Referenced by art::MixFilter< T >::filter().
|
private |
Definition at line 343 of file MixHelper.cc.
References branchIDLists_, buildProductIDTransMap_(), currentDataTrees_, currentFile_, currentFileIndex_, currentMetaDataTree_, dataBranches_, dist_, e, art::FileFormatVersion::era_, eventIDIndex_, ffVersion_, art::errors::FileOpenError, art::errors::FileReadError, art::getFileFormatEra(), art::InEvent, art::rootNames::metaDataTreeName(), n, nEventsInFile_, art::Open, art::ProdToProdMapBuilder::prepareTranslationTables(), ptpBuilder_, RANDOM_NO_REPLACE, art::detail::readFileIndex(), art::detail::readMetadata(), readMode_, and shuffledSequence_.
Referenced by openNextFile_().
|
private |
Definition at line 422 of file MixHelper.cc.
References canWrapFiles_, eventsToSkip_, ffVersion_, fileIter_, filenames_, art::FileFormatVersion::isValid(), nEventsReadThisFile_, openAndReadMetaData_(), providerFunc_, readMode_, SEQUENTIAL, and totalEventsRead_.
Referenced by generateEventSequence().
|
inline |
Definition at line 407 of file MixHelper.h.
References art::ProductRegistryHelper::produces(), and producesProvider_.
|
inline |
Definition at line 415 of file MixHelper.h.
References B, art::ProductRegistryHelper::produces(), and producesProvider_.
|
inline |
void art::MixHelper::registerSecondaryFileNameProvider | ( | ProviderFunc_ | func | ) |
Definition at line 132 of file MixHelper.cc.
References art::errors::Configuration, filenames_, and providerFunc_.
void art::MixHelper::setEventsToSkipFunction | ( | std::function< size_t()> | eventsToSkip | ) |
Definition at line 310 of file MixHelper.cc.
References eventsToSkip_.
Referenced by art::detail::setup_eventsToSkip< T >::setup_eventsToSkip().
|
private |
Definition at line 378 of file MixHelper.h.
Referenced by mixAndPut(), and openAndReadMetaData_().
|
private |
Definition at line 376 of file MixHelper.h.
Referenced by MixHelper(), and openNextFile_().
|
private |
Definition at line 366 of file MixHelper.h.
Referenced by declareMixOp(), and MixHelper().
|
private |
Definition at line 372 of file MixHelper.h.
Referenced by generateEventSequence(), and MixHelper().
|
private |
Definition at line 391 of file MixHelper.h.
Referenced by generateEventAuxiliarySequence(), and openAndReadMetaData_().
|
private |
Definition at line 388 of file MixHelper.h.
Referenced by mixAndPut(), and openAndReadMetaData_().
|
private |
Definition at line 392 of file MixHelper.h.
Referenced by mixAndPut(), and openAndReadMetaData_().
|
private |
Definition at line 389 of file MixHelper.h.
Referenced by openAndReadMetaData_().
|
private |
Definition at line 393 of file MixHelper.h.
Referenced by buildProductIDTransMap_(), and openAndReadMetaData_().
|
private |
Definition at line 381 of file MixHelper.h.
Referenced by generateEventSequence(), MixHelper(), and openAndReadMetaData_().
|
private |
Definition at line 395 of file MixHelper.h.
Referenced by generateEventSequence(), and openAndReadMetaData_().
|
private |
Definition at line 382 of file MixHelper.h.
Referenced by openNextFile_(), and setEventsToSkipFunction().
|
private |
Definition at line 377 of file MixHelper.h.
Referenced by generateEventSequence(), openAndReadMetaData_(), and openNextFile_().
|
private |
Definition at line 370 of file MixHelper.h.
Referenced by MixHelper(), and openNextFile_().
|
private |
Definition at line 365 of file MixHelper.h.
Referenced by MixHelper(), openNextFile_(), and registerSecondaryFileNameProvider().
|
private |
Definition at line 385 of file MixHelper.h.
Referenced by declareMixOp(), and mixAndPut().
|
private |
Definition at line 384 of file MixHelper.h.
Referenced by declareMixOp(), and mixAndPut().
|
private |
Definition at line 368 of file MixHelper.h.
Referenced by buildProductIDTransMap_(), declareMixOp(), and mixAndPut().
|
private |
Definition at line 374 of file MixHelper.h.
Referenced by generateEventSequence(), and openAndReadMetaData_().
|
private |
Definition at line 373 of file MixHelper.h.
Referenced by generateEventSequence(), mixAndPut(), and openNextFile_().
|
private |
Definition at line 364 of file MixHelper.h.
Referenced by produces().
|
private |
Definition at line 367 of file MixHelper.h.
Referenced by openNextFile_(), and registerSecondaryFileNameProvider().
|
private |
Definition at line 380 of file MixHelper.h.
Referenced by mixAndPut(), and openAndReadMetaData_().
|
private |
Definition at line 369 of file MixHelper.h.
Referenced by mixAndPut().
|
private |
Definition at line 371 of file MixHelper.h.
Referenced by generateEventSequence(), MixHelper(), openAndReadMetaData_(), openNextFile_(), and readMode().
|
private |
Definition at line 383 of file MixHelper.h.
Referenced by generateEventSequence(), and openAndReadMetaData_().
|
private |
Definition at line 375 of file MixHelper.h.
Referenced by mixAndPut(), and openNextFile_().