All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Attributes | List of all members
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 28 of file LArRawInputDriverLongBo.h.

Member Typedef Documentation

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

Definition at line 49 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 279 of file LArRawInputDriverLongBo.cxx.

282  :
283  principalMaker_(pm)
284  , currentDir_ ()
285  , inputfiles_ ( )
286  , nextfile_ ( inputfiles_.begin() )
287  , filesdone_ ( inputfiles_.end() )
288  , currentSubRunID_ ( )
289  {
290  helper.reconstitutes<raw::DAQHeader, art::InEvent>("daq");
291  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>("daq");
292  helper.reconstitutes<std::vector<raw::ExternalTrigger>,art::InEvent>("daq");
293  helper.reconstitutes<sumdata::RunData, art::InRun> ("daq");
294  }
stringvec_t::const_iterator nextfile_
art::SourceHelper const & principalMaker_
stringvec_t::const_iterator filesdone_

Member Function Documentation

void lris::LArRawInputDriverLongBo::closeCurrentFile ( )

Definition at line 296 of file LArRawInputDriverLongBo.cxx.

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

Definition at line 301 of file LArRawInputDriverLongBo.cxx.

303  {
304  // Get the list of event files for this directory.
305  currentDir_ = name;
306  inputfiles_ = getsortedfiles(currentDir_);
307  nextfile_ = inputfiles_.begin();
308  filesdone_ = inputfiles_.end();
309  currentSubRunID_ = art::SubRunID();
310 
311  // Fill and return a new Fileblock.
312  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"),
313  currentDir_);
314  }
stringvec_t::const_iterator nextfile_
then echo fcl name
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 316 of file LArRawInputDriverLongBo.cxx.

321  {
322  if (inputfiles_.empty() || nextfile_ == filesdone_ ) return false;
323 
324  // Create empty result, then fill it from current filename:
325  std::unique_ptr<std::vector<raw::RawDigit> > rdcollb ( new std::vector<raw::RawDigit> );
326  std::unique_ptr<std::vector<raw::ExternalTrigger> > etcollb ( new std::vector<raw::ExternalTrigger> );
327 
328  raw::DAQHeader daqHeader;
329  bool firstEventInRun = (nextfile_ == inputfiles_.begin());
330 
331  process_LAr_file( currentDir_, *nextfile_++, *rdcollb, daqHeader, *etcollb);
332  std::unique_ptr<raw::DAQHeader> daqcollb( new raw::DAQHeader(daqHeader) );
333 
334  art::RunNumber_t rn = daqHeader.GetRun();
335  art::Timestamp tstamp = daqHeader.GetTimeStamp();
336 
337  if (firstEventInRun)
338  {
339  std::unique_ptr<sumdata::RunData> rundata(new sumdata::RunData("bo") );
340  currentSubRunID_ = art::SubRunID(rn, 1);
341  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
342  outSR = principalMaker_.makeSubRunPrincipal(rn,
343  currentSubRunID_.subRun(),
344  tstamp);
345  art::put_product_in_principal(std::move(rundata), *outR, "daq");
346  } else if (rn != currentSubRunID_.run())
347  {
348  throw cet::exception("InconsistentEventStream")
349  << "Encountered run #" << rn
350  << " while processing events from run #" << currentSubRunID_.run()
351  << "\n";
352  }
353 
354  outE = principalMaker_.makeEventPrincipal(currentSubRunID_.run(),
355  currentSubRunID_.subRun(),
356  daqHeader.GetEvent(),
357  tstamp);
358 
359  // Put products in the event.
360  art::put_product_in_principal(std::move(etcollb),
361  *outE,
362  "daq"); // Module label
363  art::put_product_in_principal(std::move(rdcollb),
364  *outE,
365  "daq"); // Module label
366  art::put_product_in_principal(std::move(daqcollb),
367  *outE,
368  "daq"); // Module label
369 
370  return true;
371  }
stringvec_t::const_iterator nextfile_
art::SourceHelper const & principalMaker_
unsigned short GetRun() const
Definition: DAQHeader.h:103
unsigned short GetEvent() const
Definition: DAQHeader.h:105
stringvec_t::const_iterator filesdone_
time_t GetTimeStamp() const
Definition: DAQHeader.h:106

Member Data Documentation

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

Definition at line 52 of file LArRawInputDriverLongBo.h.

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

Definition at line 56 of file LArRawInputDriverLongBo.h.

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

Definition at line 55 of file LArRawInputDriverLongBo.h.

stringvec_t lris::LArRawInputDriverLongBo::inputfiles_
private

Definition at line 53 of file LArRawInputDriverLongBo.h.

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

Definition at line 54 of file LArRawInputDriverLongBo.h.

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

Definition at line 51 of file LArRawInputDriverLongBo.h.


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