Public Member Functions | Private Attributes | List of all members
arttest::GeneratorTestDetail Class Reference

Public Member Functions

 GeneratorTestDetail (GeneratorTestDetail const &)=delete
 
GeneratorTestDetailoperator= (GeneratorTestDetail const &)=delete
 
 GeneratorTestDetail (fhicl::ParameterSet const &ps, art::ProductRegistryHelper &help, art::SourceHelper const &sHelper)
 
void closeCurrentFile ()
 
void readFile (std::string const &name, art::FileBlock *&fb)
 
bool readNext (art::RunPrincipal const *const inR, art::SubRunPrincipal const *const inSR, art::RunPrincipal *&outR, art::SubRunPrincipal *&outSR, art::EventPrincipal *&outE)
 

Private Attributes

bool readFileCalled_ {false}
 
art::SourceHelper const & sHelper_
 
size_t ev_num_ {}
 
std::unique_ptr< arttest::ReadNextArbitratorreadNext_
 

Detailed Description

Definition at line 16 of file GeneratorTest_source.cc.

Constructor & Destructor Documentation

arttest::GeneratorTestDetail::GeneratorTestDetail ( GeneratorTestDetail const &  )
delete
arttest::GeneratorTestDetail::GeneratorTestDetail ( fhicl::ParameterSet const &  ps,
art::ProductRegistryHelper help,
art::SourceHelper const &  sHelper 
)

Definition at line 43 of file GeneratorTest_source.cc.

47  : sHelper_{sHelper}
48  , readNext_{art::make_tool<ReadNextArbitrator>(
49  pset.get<fhicl::ParameterSet>("readNextImpl"))}
50 {}
std::unique_ptr< arttest::ReadNextArbitrator > readNext_
art::SourceHelper const & sHelper_

Member Function Documentation

void arttest::GeneratorTestDetail::closeCurrentFile ( )

Definition at line 53 of file GeneratorTest_source.cc.

54 {}
GeneratorTestDetail& arttest::GeneratorTestDetail::operator= ( GeneratorTestDetail const &  )
delete
void arttest::GeneratorTestDetail::readFile ( std::string const &  name,
art::FileBlock *&  fb 
)

Definition at line 57 of file GeneratorTest_source.cc.

59 {
60  assert(!readFileCalled_);
61  assert(name.empty());
62  readFileCalled_ = true;
63  fb = new art::FileBlock(art::FileFormatVersion(1, "GeneratorTest2012"),
64  "nothing");
65 }
bool arttest::GeneratorTestDetail::readNext ( art::RunPrincipal const *const  inR,
art::SubRunPrincipal const *const  inSR,
art::RunPrincipal *&  outR,
art::SubRunPrincipal *&  outSR,
art::EventPrincipal *&  outE 
)

Definition at line 68 of file GeneratorTest_source.cc.

73 {
74  art::Timestamp runstart;
75  if (++ev_num_ > readNext_->threshold()) {
76  return false;
77  }
78  if (inR == nullptr) {
79  outR = sHelper_.makeRunPrincipal(1, runstart);
80  }
81  if (inSR == nullptr) {
82  art::SubRunID srid{outR ? outR->run() : inR->run(), 0};
83  outSR = sHelper_.makeSubRunPrincipal(srid.run(), srid.subRun(), runstart);
84  }
85  outE = sHelper_.makeEventPrincipal(outR ? outR->run() : inR->run(),
86  outSR ? outSR->subRun() : inSR->subRun(),
87  ev_num_,
88  runstart);
89  return true;
90 }
RunNumber_t run() const
Definition: Principal.cc:1192
std::unique_ptr< arttest::ReadNextArbitrator > readNext_
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
Definition: SourceHelper.cc:83
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:55
art::SourceHelper const & sHelper_
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::unique_ptr< History > &&history) const
SubRunNumber_t subRun() const
Definition: Principal.cc:1204

Member Data Documentation

size_t arttest::GeneratorTestDetail::ev_num_ {}
private

Definition at line 38 of file GeneratorTest_source.cc.

bool arttest::GeneratorTestDetail::readFileCalled_ {false}
private

Definition at line 36 of file GeneratorTest_source.cc.

std::unique_ptr<arttest::ReadNextArbitrator> arttest::GeneratorTestDetail::readNext_
private

Definition at line 40 of file GeneratorTest_source.cc.

art::SourceHelper const& arttest::GeneratorTestDetail::sHelper_
private

Definition at line 37 of file GeneratorTest_source.cc.


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