LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
#include "MixHelper.h"
Classes | |
struct | Config |
Public Types | |
enum | Mode { Mode::SEQUENTIAL = 0, Mode::RANDOM_REPLACE, Mode::RANDOM_LIM_REPLACE, Mode::RANDOM_NO_REPLACE, Mode::UNKNOWN } |
Public Member Functions | |
MixHelper (Config const &config, std::string const &moduleLabel, ProducesCollector &collector, std::unique_ptr< MixIOPolicy > ioHandle) | |
MixHelper (fhicl::ParameterSet const &pset, std::string const &moduleLabel, ProducesCollector &collector, std::unique_ptr< MixIOPolicy > ioHandle) | |
~MixHelper () | |
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) |
base_engine_t & | createEngine (seed_t seed) |
base_engine_t & | createEngine (seed_t seed, std::string const &kind_of_engine_to_make) |
base_engine_t & | createEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label) |
bool | generateEventSequence (size_t nSecondaries, EntryNumberSequence &enSeq, EventIDSequence &eIDseq) |
EventAuxiliarySequence | generateEventAuxiliarySequence (EntryNumberSequence const &) |
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 | |
using | ProviderFunc_ = std::function< std::string()> |
using | MixOpList = std::vector< std::unique_ptr< MixOpBase >> |
using | base_engine_t = CLHEP::HepRandomEngine |
using | label_t = RNGsnapshot::label_t |
using | seed_t = long |
using | engine_state_t = RNGsnapshot::engine_state_t |
Private Member Functions | |
MixHelper (MixHelper const &)=delete | |
MixHelper & | operator= (MixHelper const &)=delete |
cet::exempt_ptr< base_engine_t > | initEngine_ (seed_t seed, Mode readMode) |
std::unique_ptr< CLHEP::RandFlat > | initDist_ (cet::exempt_ptr< base_engine_t > engine) const |
bool | consistentRequest_ (std::string const &kind_of_engine_to_make, label_t const &engine_label) const |
Mode | initReadMode_ (std::string const &mode) const |
bool | openNextFile_ () |
ProdToProdMapBuilder::ProductIDTransMap | buildProductIDTransMap_ (MixOpList &mixOps) |
Private Attributes | |
ProducesCollector & | collector_ |
std::string const | moduleLabel_ |
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_ |
std::size_t | nEventsReadThisFile_ {} |
std::size_t | totalEventsRead_ {} |
bool const | canWrapFiles_ |
unsigned | nOpensOverThreshold_ {} |
ProdToProdMapBuilder | ptpBuilder_ {} |
cet::exempt_ptr< base_engine_t > | engine_ |
std::unique_ptr< CLHEP::RandFlat > | dist_ |
std::function< size_t()> | eventsToSkip_ {} |
EntryNumberSequence | shuffledSequence_ {} |
bool | haveSubRunMixOps_ {false} |
bool | haveRunMixOps_ {false} |
EventIDIndex | eventIDIndex_ {} |
std::unique_ptr< MixIOPolicy > | ioHandle_ {nullptr} |
Definition at line 245 of file MixHelper.h.
|
inherited |
Definition at line 36 of file EngineCreator.h.
|
inherited |
Definition at line 39 of file EngineCreator.h.
|
inherited |
Definition at line 37 of file EngineCreator.h.
|
private |
Definition at line 382 of file MixHelper.h.
|
private |
Definition at line 246 of file MixHelper.h.
|
inherited |
Definition at line 38 of file EngineCreator.h.
|
strong |
Enumerator | |
---|---|
SEQUENTIAL | |
RANDOM_REPLACE | |
RANDOM_LIM_REPLACE | |
RANDOM_NO_REPLACE | |
UNKNOWN |
Definition at line 249 of file MixHelper.h.
|
explicit |
Definition at line 108 of file MixHelper.cc.
References canWrapFiles_, collector_, compactMissingProducts_, coverageFraction_, dist_, engine_, fileIter_, filenames_, art::ScheduleID::first(), initDist_(), initEngine_(), initReadMode_(), ioHandle_, moduleLabel_, readMode_, and ~MixHelper().
|
explicit |
Definition at line 89 of file MixHelper.cc.
References canWrapFiles_, collector_, compactMissingProducts_, coverageFraction_, dist_, engine_, fileIter_, filenames_, art::ScheduleID::first(), initDist_(), initEngine_(), initReadMode_(), ioHandle_, moduleLabel_, and readMode_.
|
default |
Referenced by MixHelper().
|
privatedelete |
|
private |
|
private |
Definition at line 441 of file MixHelper.cc.
References art::errors::Configuration, and readMode_.
Referenced by createEngine().
art::MixHelper::base_engine_t & art::MixHelper::createEngine | ( | seed_t | seed | ) |
Definition at line 159 of file MixHelper.cc.
References consistentRequest_(), art::detail::EngineCreator::createEngine(), and engine_.
art::MixHelper::base_engine_t & art::MixHelper::createEngine | ( | seed_t | seed, |
std::string const & | kind_of_engine_to_make | ||
) |
Definition at line 171 of file MixHelper.cc.
References consistentRequest_(), art::detail::EngineCreator::createEngine(), and engine_.
art::MixHelper::base_engine_t & art::MixHelper::createEngine | ( | seed_t | seed, |
std::string const & | kind_of_engine_to_make, | ||
label_t const & | engine_label | ||
) |
Definition at line 181 of file MixHelper.cc.
References consistentRequest_(), art::detail::EngineCreator::createEngine(), and engine_.
|
inline |
Definition at line 449 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 459 of file MixHelper.h.
References compactMissingProducts_, haveRunMixOps_, haveSubRunMixOps_, art::InRun, art::InSubRun, mixOps_, and moduleLabel_.
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 484 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 501 of file MixHelper.h.
|
inline |
Definition at line 522 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 539 of file MixHelper.h.
art::EventAuxiliarySequence art::MixHelper::generateEventAuxiliarySequence | ( | EntryNumberSequence const & | enSeq | ) |
Definition at line 279 of file MixHelper.cc.
References ioHandle_.
Referenced by art::MixFilter< T, IOPolicy >::filter().
bool art::MixHelper::generateEventSequence | ( | size_t | nSecondaries, |
EntryNumberSequence & | enSeq, | ||
EventIDSequence & | eIDseq | ||
) |
Definition at line 193 of file MixHelper.cc.
References util::begin(), util::cbegin(), util::cend(), coverageFraction_, dist_, util::end(), eventIDIndex_, filenames_, ioHandle_, art::errors::LogicError, nEventsReadThisFile_, nOpensOverThreshold_, openNextFile_(), providerFunc_, RANDOM_LIM_REPLACE, RANDOM_NO_REPLACE, RANDOM_REPLACE, readMode_, SEQUENTIAL, shuffledSequence_, and art::errors::UnimplementedFeature.
Referenced by art::MixFilter< T, IOPolicy >::filter().
|
private |
Definition at line 480 of file MixHelper.cc.
Referenced by MixHelper().
|
private |
Definition at line 463 of file MixHelper.cc.
References art::errors::Configuration, art::detail::EngineCreator::createEngine(), and SEQUENTIAL.
Referenced by MixHelper().
|
private |
Definition at line 366 of file MixHelper.cc.
References art::errors::Configuration, and r.
Referenced by MixHelper().
void art::MixHelper::mixAndPut | ( | EntryNumberSequence const & | enSeq, |
EventIDSequence const & | eIDseq, | ||
Event & | e | ||
) |
Definition at line 289 of file MixHelper.cc.
References util::cend(), fileIter_, art::FileIndex::findPosition(), art::ProdToProdMapBuilder::getRemapper(), haveRunMixOps_, haveSubRunMixOps_, art::InEvent, art::InRun, art::InSubRun, ioHandle_, art::errors::LogicError, mixOps_, nEventsReadThisFile_, art::errors::NotFound, ptpBuilder_, ptrRemapper_, and totalEventsRead_.
Referenced by art::MixFilter< T, IOPolicy >::filter().
|
private |
Definition at line 393 of file MixHelper.cc.
References canWrapFiles_, eventIDIndex_, eventsToSkip_, fileIter_, filenames_, ioHandle_, mixOps_, nEventsReadThisFile_, art::ProdToProdMapBuilder::prepareTranslationTables(), providerFunc_, ptpBuilder_, RANDOM_NO_REPLACE, readMode_, SEQUENTIAL, shuffledSequence_, and totalEventsRead_.
Referenced by generateEventSequence().
|
inline |
Definition at line 433 of file MixHelper.h.
References collector_, and art::ProducesCollector::produces().
|
inline |
Definition at line 441 of file MixHelper.h.
References collector_, and art::ProducesCollector::produces().
|
inline |
void art::MixHelper::registerSecondaryFileNameProvider | ( | ProviderFunc_ | func | ) |
Definition at line 148 of file MixHelper.cc.
References art::errors::Configuration, filenames_, and providerFunc_.
void art::MixHelper::setEventsToSkipFunction | ( | std::function< size_t()> | eventsToSkip | ) |
Definition at line 360 of file MixHelper.cc.
References eventsToSkip_.
Referenced by art::MixFilter< T, IOPolicy >::MixFilter().
|
private |
Definition at line 407 of file MixHelper.h.
Referenced by MixHelper(), and openNextFile_().
|
private |
Definition at line 395 of file MixHelper.h.
Referenced by MixHelper(), and produces().
|
private |
Definition at line 398 of file MixHelper.h.
Referenced by declareMixOp(), and MixHelper().
|
private |
Definition at line 404 of file MixHelper.h.
Referenced by generateEventSequence(), and MixHelper().
|
private |
Definition at line 411 of file MixHelper.h.
Referenced by generateEventSequence(), and MixHelper().
|
private |
Definition at line 410 of file MixHelper.h.
Referenced by createEngine(), and MixHelper().
|
private |
Definition at line 416 of file MixHelper.h.
Referenced by generateEventSequence(), and openNextFile_().
|
private |
Definition at line 412 of file MixHelper.h.
Referenced by openNextFile_(), and setEventsToSkipFunction().
|
private |
Definition at line 402 of file MixHelper.h.
Referenced by mixAndPut(), MixHelper(), and openNextFile_().
|
private |
Definition at line 397 of file MixHelper.h.
Referenced by generateEventSequence(), MixHelper(), openNextFile_(), and registerSecondaryFileNameProvider().
|
private |
Definition at line 415 of file MixHelper.h.
Referenced by declareMixOp(), and mixAndPut().
|
private |
Definition at line 414 of file MixHelper.h.
Referenced by declareMixOp(), and mixAndPut().
|
private |
Definition at line 418 of file MixHelper.h.
Referenced by generateEventAuxiliarySequence(), generateEventSequence(), mixAndPut(), MixHelper(), and openNextFile_().
|
private |
Definition at line 400 of file MixHelper.h.
Referenced by declareMixOp(), mixAndPut(), and openNextFile_().
|
private |
Definition at line 396 of file MixHelper.h.
Referenced by declareMixOp(), and MixHelper().
|
private |
Definition at line 405 of file MixHelper.h.
Referenced by generateEventSequence(), mixAndPut(), and openNextFile_().
|
private |
Definition at line 408 of file MixHelper.h.
Referenced by generateEventSequence().
|
private |
Definition at line 399 of file MixHelper.h.
Referenced by generateEventSequence(), openNextFile_(), and registerSecondaryFileNameProvider().
|
private |
Definition at line 409 of file MixHelper.h.
Referenced by mixAndPut(), and openNextFile_().
|
private |
Definition at line 401 of file MixHelper.h.
Referenced by mixAndPut().
|
private |
Definition at line 403 of file MixHelper.h.
Referenced by consistentRequest_(), generateEventSequence(), MixHelper(), openNextFile_(), and readMode().
|
private |
Definition at line 413 of file MixHelper.h.
Referenced by generateEventSequence(), and openNextFile_().
|
private |
Definition at line 406 of file MixHelper.h.
Referenced by mixAndPut(), and openNextFile_().