LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lris::LArRawInputDriverLongBo Class Reference

#include "LArRawInputDriverLongBo.h"

Public Member Functions

 LArRawInputDriverLongBo (fhicl::ParameterSet const &pset, art::ProductRegistryHelper &helper, art::SourceHelper const &pm)
 
void closeCurrentFile ()
 
void readFile (std::string const &name, art::FileBlock *&fb)
 
bool readNext (art::RunPrincipal *const &inR, art::SubRunPrincipal *const &inSR, art::RunPrincipal *&outR, art::SubRunPrincipal *&outSR, art::EventPrincipal *&outE)
 

Private Types

typedef std::vector< std::string > stringvec_t
 

Private Attributes

art::SourceHelper const & principalMaker_
 
std::string currentDir_
 
stringvec_t inputfiles_
 
stringvec_t::const_iterator nextfile_
 
stringvec_t::const_iterator filesdone_
 
art::SubRunID currentSubRunID_
 

Detailed Description

Definition at line 30 of file LArRawInputDriverLongBo.h.

Member Typedef Documentation

typedef std::vector<std::string> lris::LArRawInputDriverLongBo::stringvec_t
private

Definition at line 50 of file LArRawInputDriverLongBo.h.

Constructor & Destructor Documentation

lris::LArRawInputDriverLongBo::LArRawInputDriverLongBo ( fhicl::ParameterSet const &  pset,
art::ProductRegistryHelper helper,
art::SourceHelper const &  pm 
)

Class to fill the constraints on a template argument to the class, FileReaderSource

Definition at line 267 of file LArRawInputDriverLongBo.cxx.

References art::InEvent, art::InRun, and art::ProductRegistryHelper::reconstitutes().

270  : principalMaker_(pm)
271  , currentDir_()
272  , inputfiles_()
273  , nextfile_(inputfiles_.begin())
274  , filesdone_(inputfiles_.end())
275  , currentSubRunID_()
276  {
277  helper.reconstitutes<raw::DAQHeader, art::InEvent>("daq");
278  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>("daq");
279  helper.reconstitutes<std::vector<raw::ExternalTrigger>, art::InEvent>("daq");
280  helper.reconstitutes<sumdata::RunData, art::InRun>("daq");
281  }
stringvec_t::const_iterator nextfile_
art::SourceHelper const & principalMaker_
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
stringvec_t::const_iterator filesdone_

Member Function Documentation

void lris::LArRawInputDriverLongBo::closeCurrentFile ( )

Definition at line 283 of file LArRawInputDriverLongBo.cxx.

284  {
285  // Nothing to do (See EventFileSentry).
286  }
void lris::LArRawInputDriverLongBo::readFile ( std::string const &  name,
art::FileBlock *&  fb 
)

Definition at line 288 of file LArRawInputDriverLongBo.cxx.

References currentDir_, currentSubRunID_, filesdone_, inputfiles_, and nextfile_.

289  {
290  // Get the list of event files for this directory.
291  currentDir_ = name;
292  inputfiles_ = getsortedfiles(currentDir_);
293  nextfile_ = inputfiles_.begin();
294  filesdone_ = inputfiles_.end();
296 
297  // Fill and return a new Fileblock.
298  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"), currentDir_);
299  }
stringvec_t::const_iterator nextfile_
stringvec_t::const_iterator filesdone_
bool lris::LArRawInputDriverLongBo::readNext ( art::RunPrincipal *const &  inR,
art::SubRunPrincipal *const &  inSR,
art::RunPrincipal *&  outR,
art::SubRunPrincipal *&  outSR,
art::EventPrincipal *&  outE 
)

Definition at line 301 of file LArRawInputDriverLongBo.cxx.

References currentDir_, currentSubRunID_, filesdone_, raw::DAQHeader::GetEvent(), raw::DAQHeader::GetRun(), raw::DAQHeader::GetTimeStamp(), inputfiles_, art::SourceHelper::makeEventPrincipal(), art::SourceHelper::makeRunPrincipal(), art::SourceHelper::makeSubRunPrincipal(), nextfile_, principalMaker_, art::put_product_in_principal(), art::SubRunID::run(), and art::SubRunID::subRun().

306  {
307  if (inputfiles_.empty() || nextfile_ == filesdone_) return false;
308 
309  // Create empty result, then fill it from current filename:
310  std::unique_ptr<std::vector<raw::RawDigit>> rdcollb(new std::vector<raw::RawDigit>);
311  std::unique_ptr<std::vector<raw::ExternalTrigger>> etcollb(
312  new std::vector<raw::ExternalTrigger>);
313 
314  raw::DAQHeader daqHeader;
315  bool firstEventInRun = (nextfile_ == inputfiles_.begin());
316 
317  process_LAr_file(currentDir_, *nextfile_++, *rdcollb, daqHeader, *etcollb);
318  std::unique_ptr<raw::DAQHeader> daqcollb(new raw::DAQHeader(daqHeader));
319 
320  art::RunNumber_t rn = daqHeader.GetRun();
321  art::Timestamp tstamp = daqHeader.GetTimeStamp();
322 
323  if (firstEventInRun) {
324  std::unique_ptr<sumdata::RunData> rundata(new sumdata::RunData("bo"));
326  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
328  art::put_product_in_principal(std::move(rundata), *outR, "daq");
329  }
330  else if (rn != currentSubRunID_.run()) {
331  throw cet::exception("InconsistentEventStream")
332  << "Encountered run #" << rn << " while processing events from run #"
333  << currentSubRunID_.run() << "\n";
334  }
335 
337  currentSubRunID_.run(), currentSubRunID_.subRun(), daqHeader.GetEvent(), tstamp);
338 
339  // Put products in the event.
340  art::put_product_in_principal(std::move(etcollb), *outE,
341  "daq"); // Module label
342  art::put_product_in_principal(std::move(rdcollb), *outE,
343  "daq"); // Module label
344  art::put_product_in_principal(std::move(daqcollb), *outE,
345  "daq"); // Module label
346 
347  return true;
348  }
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary subRunAux) const
EventPrincipal * makeEventPrincipal(EventAuxiliary eventAux) const
stringvec_t::const_iterator nextfile_
art::SourceHelper const & principalMaker_
RunNumber_t run() const
Definition: SubRunID.h:85
RunPrincipal * makeRunPrincipal(RunAuxiliary runAux) const
Definition: SourceHelper.cc:89
std::enable_if_t<!detail::range_sets_supported(P::branch_type)> put_product_in_principal(std::unique_ptr< T > &&product, P &principal, std::string const &module_label, std::string const &instance_name={})
unsigned short GetRun() const
Definition: DAQHeader.h:141
unsigned short GetEvent() const
Definition: DAQHeader.h:149
SubRunNumber_t subRun() const
Definition: SubRunID.h:91
stringvec_t::const_iterator filesdone_
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
time_t GetTimeStamp() const
Definition: DAQHeader.h:153
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:120

Member Data Documentation

std::string lris::LArRawInputDriverLongBo::currentDir_
private

Definition at line 53 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

art::SubRunID lris::LArRawInputDriverLongBo::currentSubRunID_
private

Definition at line 57 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

stringvec_t::const_iterator lris::LArRawInputDriverLongBo::filesdone_
private

Definition at line 56 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

stringvec_t lris::LArRawInputDriverLongBo::inputfiles_
private

Definition at line 54 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

stringvec_t::const_iterator lris::LArRawInputDriverLongBo::nextfile_
private

Definition at line 55 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

art::SourceHelper const& lris::LArRawInputDriverLongBo::principalMaker_
private

Definition at line 52 of file LArRawInputDriverLongBo.h.

Referenced by readNext().


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