LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 26 of file LArRawInputDriverLongBo.h.

Member Typedef Documentation

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

Definition at line 47 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  :
271  principalMaker_(pm)
272  , currentDir_ ()
273  , inputfiles_ ( )
274  , nextfile_ ( inputfiles_.begin() )
275  , filesdone_ ( inputfiles_.end() )
276  , currentSubRunID_ ( )
277  {
278  helper.reconstitutes<raw::DAQHeader, art::InEvent>("daq");
279  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>("daq");
280  helper.reconstitutes<std::vector<raw::ExternalTrigger>,art::InEvent>("daq");
281  helper.reconstitutes<sumdata::RunData, art::InRun> ("daq");
282  }
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 284 of file LArRawInputDriverLongBo.cxx.

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

Definition at line 289 of file LArRawInputDriverLongBo.cxx.

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

291  {
292  // Get the list of event files for this directory.
293  currentDir_ = name;
294  inputfiles_ = getsortedfiles(currentDir_);
295  nextfile_ = inputfiles_.begin();
296  filesdone_ = inputfiles_.end();
298 
299  // Fill and return a new Fileblock.
300  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"),
301  currentDir_);
302  }
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 304 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().

309  {
310  if (inputfiles_.empty() || nextfile_ == filesdone_ ) return false;
311 
312  // Create empty result, then fill it from current filename:
313  std::unique_ptr<std::vector<raw::RawDigit> > rdcollb ( new std::vector<raw::RawDigit> );
314  std::unique_ptr<std::vector<raw::ExternalTrigger> > etcollb ( new std::vector<raw::ExternalTrigger> );
315 
316  raw::DAQHeader daqHeader;
317  bool firstEventInRun = (nextfile_ == inputfiles_.begin());
318 
319  process_LAr_file( currentDir_, *nextfile_++, *rdcollb, daqHeader, *etcollb);
320  std::unique_ptr<raw::DAQHeader> daqcollb( new raw::DAQHeader(daqHeader) );
321 
322  art::RunNumber_t rn = daqHeader.GetRun();
323  art::Timestamp tstamp = daqHeader.GetTimeStamp();
324 
325  if (firstEventInRun)
326  {
327  std::unique_ptr<sumdata::RunData> rundata(new sumdata::RunData("bo") );
329  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
332  tstamp);
333  art::put_product_in_principal(std::move(rundata), *outR, "daq");
334  } else if (rn != currentSubRunID_.run())
335  {
336  throw cet::exception("InconsistentEventStream")
337  << "Encountered run #" << rn
338  << " while processing events from run #" << currentSubRunID_.run()
339  << "\n";
340  }
341 
344  daqHeader.GetEvent(),
345  tstamp);
346 
347  // Put products in the event.
348  art::put_product_in_principal(std::move(etcollb),
349  *outE,
350  "daq"); // Module label
351  art::put_product_in_principal(std::move(rdcollb),
352  *outE,
353  "daq"); // Module label
354  art::put_product_in_principal(std::move(daqcollb),
355  *outE,
356  "daq"); // Module label
357 
358  return true;
359  }
std::enable_if_t< P::branch_type==InEvent||P::branch_type==InResults > put_product_in_principal(std::unique_ptr< T > &&product, P &principal, std::string const &module_label, std::string const &instance_name={})
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
Definition: SourceHelper.cc:59
stringvec_t::const_iterator nextfile_
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:36
art::SourceHelper const & principalMaker_
RunNumber_t run() const
Definition: SubRunID.h:84
unsigned short GetRun() const
Definition: DAQHeader.h:105
unsigned short GetEvent() const
Definition: DAQHeader.h:107
SubRunNumber_t subRun() const
Definition: SubRunID.h:90
stringvec_t::const_iterator filesdone_
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::shared_ptr< History > &&history) const
Definition: SourceHelper.cc:83
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
time_t GetTimeStamp() const
Definition: DAQHeader.h:108
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:119

Member Data Documentation

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

Definition at line 50 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 54 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 53 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

stringvec_t lris::LArRawInputDriverLongBo::inputfiles_
private

Definition at line 51 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 52 of file LArRawInputDriverLongBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 49 of file LArRawInputDriverLongBo.h.

Referenced by readNext().


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