Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
art::MixHelper Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/art/v2_13_00/source/art/Framework/IO/ProductMix/MixHelper.h"

Public Types

enum  Mode {
  Mode::SEQUENTIAL = 0, Mode::RANDOM_REPLACE, Mode::RANDOM_LIM_REPLACE, Mode::RANDOM_NO_REPLACE,
  Mode::UNKNOWN
}
 

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

using ProviderFunc_ = std::function< std::string()>
 
using MixOpList = std::vector< std::unique_ptr< MixOpBase >>
 

Private Member Functions

 MixHelper (MixHelper const &)=delete
 
MixHelperoperator= (MixHelper const &)=delete
 
Mode initReadMode_ (std::string const &mode) const
 
void openAndReadMetaData_ (std::string fileName)
 
bool openNextFile_ ()
 
void buildProductIDTransMap_ (ProdToProdMapBuilder::ProductIDTransMap &transMap)
 

Private Attributes

ProducerBaseproducesProvider_
 
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_
 
unsigned nOpensOverThreshold_ {}
 
FileFormatVersion ffVersion_ {}
 
std::unique_ptr< art::BranchIDLists > branchIDLists_
 
ProdToProdMapBuilder ptpBuilder_ {}
 
std::unique_ptr< CLHEP::RandFlatdist_
 
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_ {}
 

Detailed Description

Definition at line 245 of file MixHelper.h.

Member Typedef Documentation

using art::MixHelper::MixOpList = std::vector<std::unique_ptr<MixOpBase>>
private

Definition at line 355 of file MixHelper.h.

using art::MixHelper::ProviderFunc_ = std::function<std::string()>
private

Definition at line 246 of file MixHelper.h.

Member Enumeration Documentation

enum art::MixHelper::Mode
strong
Enumerator
SEQUENTIAL 
RANDOM_REPLACE 
RANDOM_LIM_REPLACE 
RANDOM_NO_REPLACE 
UNKNOWN 

Definition at line 249 of file MixHelper.h.

249  {
250  SEQUENTIAL = 0,
251  RANDOM_REPLACE,
252  RANDOM_LIM_REPLACE,
253  RANDOM_NO_REPLACE,
254  UNKNOWN
255  };

Constructor & Destructor Documentation

art::MixHelper::MixHelper ( fhicl::ParameterSet const &  pset,
ProducerBase producesProvider 
)
art::MixHelper::MixHelper ( MixHelper const &  )
privatedelete

Member Function Documentation

void art::MixHelper::buildProductIDTransMap_ ( ProdToProdMapBuilder::ProductIDTransMap transMap)
private
template<art::BranchType B, typename PROD , typename OPROD >
void art::MixHelper::declareMixOp ( InputTag const &  inputTag,
MixFunc< PROD, OPROD >  mixFunc,
bool  outputProduct = true 
)
inline

Definition at line 428 of file MixHelper.h.

References art::InputTag::instance().

Referenced by lem::LEMMixer::LEMMixer(), mix::MixSimAndCosmicData::MixSimAndCosmicData(), sim::MixSimAndRealEventsDetail::MixSimAndRealEventsDetail(), and mix::MixSimEvents::MixSimEvents().

431 {
432  declareMixOp<B>(inputTag, inputTag.instance(), mixFunc, outputProduct); // 2.
433 }
template<art::BranchType B, typename PROD , typename OPROD >
void art::MixHelper::declareMixOp ( InputTag const &  inputTag,
std::string const &  outputInstanceLabel,
MixFunc< PROD, OPROD >  mixFunc,
bool  outputProduct = true 
)

Definition at line 438 of file MixHelper.h.

References compactMissingProducts_, haveRunMixOps_, haveSubRunMixOps_, art::InRun, art::InSubRun, and mixOps_.

442 {
443  if (outputProduct) {
444  produces<OPROD>(outputInstanceLabel);
445  }
446  if (B == art::InSubRun) {
447  haveSubRunMixOps_ = true;
448  } else if (B == art::InRun) {
449  haveRunMixOps_ = true;
450  }
451  mixOps_.emplace_back(new MixOp<PROD, OPROD>(inputTag,
452  outputInstanceLabel,
453  mixFunc,
454  outputProduct,
456  B));
457 }
MixOpList mixOps_
Definition: MixHelper.h:368
bool haveSubRunMixOps_
Definition: MixHelper.h:385
bool compactMissingProducts_
Definition: MixHelper.h:366
bool haveRunMixOps_
Definition: MixHelper.h:386
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T >
void art::MixHelper::declareMixOp ( InputTag const &  inputTag,
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &)  mixfunc,
T t,
bool  outputProduct = true 
)
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T >
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 
)
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T >
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 
)
template<art::BranchType B = art::InEvent, typename PROD , typename OPROD , typename T >
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 
)
template<art::BranchType B, typename PROD , typename OPROD , typename T >
void art::MixHelper::declareMixOp ( InputTag const &  inputTag,
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &)  mixFunc,
T t,
bool  outputProduct 
)
inline

Definition at line 462 of file MixHelper.h.

References art::InputTag::instance(), and confusionMatrixTree::t.

468 {
469  declareMixOp<B>(
470  inputTag, inputTag.instance(), mixFunc, t, outputProduct); // 4.
471 }
template<art::BranchType B, typename PROD , typename OPROD , typename T >
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 476 of file MixHelper.h.

483 {
484  using std::placeholders::_1;
485  using std::placeholders::_2;
486  using std::placeholders::_3;
487  declareMixOp<B>(
488  inputTag,
489  outputInstanceLabel,
490  static_cast<MixFunc<PROD, OPROD>>(std::bind(mixFunc, &t, _1, _2, _3)),
491  outputProduct); // 2.
492 }
template<art::BranchType B, typename PROD , typename OPROD , typename T >
void art::MixHelper::declareMixOp ( InputTag const &  inputTag,
bool(T::*)(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &) const  mixFunc,
T const &  t,
bool  outputProduct 
)
inline

Definition at line 497 of file MixHelper.h.

References art::InputTag::instance(), and confusionMatrixTree::t.

503 {
504  declareMixOp<B>(
505  inputTag, inputTag.instance(), mixFunc, t, outputProduct); // 6.
506 }
template<art::BranchType B, typename PROD , typename OPROD , typename T >
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 511 of file MixHelper.h.

518 {
519  using std::placeholders::_1;
520  using std::placeholders::_2;
521  using std::placeholders::_3;
522  declareMixOp<B>(
523  inputTag,
524  outputInstanceLabel,
525  static_cast<MixFunc<PROD, OPROD>>(std::bind(mixFunc, &t, _1, _2, _3)),
526  outputProduct); // 2.
527 }
void art::MixHelper::generateEventAuxiliarySequence ( EntryNumberSequence const &  ,
EventAuxiliarySequence  
)
bool art::MixHelper::generateEventSequence ( size_t  nSecondaries,
EntryNumberSequence enSeq,
EventIDSequence eIDseq 
)
Mode art::MixHelper::initReadMode_ ( std::string const &  mode) const
private
void art::MixHelper::mixAndPut ( EntryNumberSequence const &  enSeq,
EventIDSequence const &  eIDseq,
Event e 
)
void art::MixHelper::openAndReadMetaData_ ( std::string  fileName)
private
bool art::MixHelper::openNextFile_ ( )
private
MixHelper& art::MixHelper::operator= ( MixHelper const &  )
privatedelete
template<class P >
void art::MixHelper::produces ( std::string const &  instanceName = {})
inline

Definition at line 412 of file MixHelper.h.

References P, art::ProductRegistryHelper::produces(), and producesProvider_.

413 {
414  producesProvider_.produces<P>(instanceName);
415 }
ProducerBase & producesProvider_
Definition: MixHelper.h:364
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
#define P(a, b, c, d, e, x)
template<class P , art::BranchType B>
void art::MixHelper::produces ( std::string const &  instanceName = {})
inline

Definition at line 420 of file MixHelper.h.

References P, art::ProductRegistryHelper::produces(), and producesProvider_.

421 {
422  producesProvider_.produces<P, B>(instanceName);
423 }
ProducerBase & producesProvider_
Definition: MixHelper.h:364
void produces(std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
#define P(a, b, c, d, e, x)
auto art::MixHelper::readMode ( ) const
inline

Definition at line 404 of file MixHelper.h.

References readMode_.

405 {
406  return readMode_;
407 }
Mode const readMode_
Definition: MixHelper.h:371
void art::MixHelper::registerSecondaryFileNameProvider ( ProviderFunc_  func)

Referenced by lem::LEMMixer::LEMMixer().

void art::MixHelper::setEventsToSkipFunction ( std::function< size_t()>  eventsToSkip)

Member Data Documentation

std::unique_ptr<art::BranchIDLists> art::MixHelper::branchIDLists_
private
Initial value:
{
nullptr}

Definition at line 379 of file MixHelper.h.

bool const art::MixHelper::canWrapFiles_
private

Definition at line 376 of file MixHelper.h.

bool art::MixHelper::compactMissingProducts_
private

Definition at line 366 of file MixHelper.h.

Referenced by declareMixOp().

double const art::MixHelper::coverageFraction_
private

Definition at line 372 of file MixHelper.h.

std::array<cet::exempt_ptr<TTree>, art::BranchType::NumBranchTypes> art::MixHelper::currentDataTrees_ {{nullptr}}
private

Definition at line 392 of file MixHelper.h.

cet::value_ptr<TFile> art::MixHelper::currentFile_ {}
private

Definition at line 389 of file MixHelper.h.

FileIndex art::MixHelper::currentFileIndex_ {}
private

Definition at line 393 of file MixHelper.h.

cet::exempt_ptr<TTree> art::MixHelper::currentMetaDataTree_ {nullptr}
private

Definition at line 390 of file MixHelper.h.

std::array<RootBranchInfoList, art::BranchType::NumBranchTypes> art::MixHelper::dataBranches_
private
Initial value:
{
{}}

Definition at line 394 of file MixHelper.h.

std::unique_ptr<CLHEP::RandFlat> art::MixHelper::dist_
private

Definition at line 382 of file MixHelper.h.

EventIDIndex art::MixHelper::eventIDIndex_ {}
private

Definition at line 396 of file MixHelper.h.

std::function<size_t()> art::MixHelper::eventsToSkip_ {}
private

Definition at line 383 of file MixHelper.h.

FileFormatVersion art::MixHelper::ffVersion_ {}
private

Definition at line 378 of file MixHelper.h.

std::vector<std::string>::const_iterator art::MixHelper::fileIter_
private

Definition at line 370 of file MixHelper.h.

std::vector<std::string> const art::MixHelper::filenames_
private

Definition at line 365 of file MixHelper.h.

bool art::MixHelper::haveRunMixOps_ {false}
private

Definition at line 386 of file MixHelper.h.

Referenced by declareMixOp().

bool art::MixHelper::haveSubRunMixOps_ {false}
private

Definition at line 385 of file MixHelper.h.

Referenced by declareMixOp().

MixOpList art::MixHelper::mixOps_ {}
private

Definition at line 368 of file MixHelper.h.

Referenced by declareMixOp().

Long64_t art::MixHelper::nEventsInFile_ {}
private

Definition at line 374 of file MixHelper.h.

Long64_t art::MixHelper::nEventsReadThisFile_ {}
private

Definition at line 373 of file MixHelper.h.

unsigned art::MixHelper::nOpensOverThreshold_ {}
private

Definition at line 377 of file MixHelper.h.

ProducerBase& art::MixHelper::producesProvider_
private

Definition at line 364 of file MixHelper.h.

Referenced by produces().

ProviderFunc_ art::MixHelper::providerFunc_ {}
private

Definition at line 367 of file MixHelper.h.

ProdToProdMapBuilder art::MixHelper::ptpBuilder_ {}
private

Definition at line 381 of file MixHelper.h.

PtrRemapper art::MixHelper::ptrRemapper_ {}
private

Definition at line 369 of file MixHelper.h.

Mode const art::MixHelper::readMode_
private

Definition at line 371 of file MixHelper.h.

Referenced by readMode().

EntryNumberSequence art::MixHelper::shuffledSequence_ {}
private

Definition at line 384 of file MixHelper.h.

Long64_t art::MixHelper::totalEventsRead_ {}
private

Definition at line 375 of file MixHelper.h.


The documentation for this class was generated from the following file: