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

#include "LArRawInputDriverShortBo.h"

Public Member Functions

 LArRawInputDriverShortBo (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 LArRawInputDriverShortBo.h.

Member Typedef Documentation

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

Definition at line 50 of file LArRawInputDriverShortBo.h.

Constructor & Destructor Documentation

lris::LArRawInputDriverShortBo::LArRawInputDriverShortBo ( 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 221 of file LArRawInputDriverShortBo.cxx.

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

224  : principalMaker_(pm)
225  , currentDir_()
226  , inputfiles_()
227  , nextfile_(inputfiles_.begin())
228  , filesdone_(inputfiles_.end())
229  , currentSubRunID_()
230  {
231  helper.reconstitutes<raw::DAQHeader, art::InEvent>("daq");
232  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>("daq");
233  helper.reconstitutes<sumdata::RunData, art::InRun>("daq");
234  }
stringvec_t::const_iterator filesdone_
art::SourceHelper const & principalMaker_
TypeLabel const & reconstitutes(std::string const &modLabel, std::string const &instanceName={})
stringvec_t::const_iterator nextfile_

Member Function Documentation

void lris::LArRawInputDriverShortBo::closeCurrentFile ( )

Definition at line 236 of file LArRawInputDriverShortBo.cxx.

237  {
238  // Nothing to do (See EventFileSentry).
239  }
void lris::LArRawInputDriverShortBo::readFile ( std::string const &  name,
art::FileBlock *&  fb 
)

Definition at line 241 of file LArRawInputDriverShortBo.cxx.

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

242  {
243  // Get the list of event files for this directory.
244  currentDir_ = name;
245  inputfiles_ = getsortedfiles(currentDir_);
246  nextfile_ = inputfiles_.begin();
247  filesdone_ = inputfiles_.end();
249 
250  // Fill and return a new Fileblock.
251  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"), currentDir_);
252  }
stringvec_t::const_iterator filesdone_
stringvec_t::const_iterator nextfile_
bool lris::LArRawInputDriverShortBo::readNext ( art::RunPrincipal *const &  inR,
art::SubRunPrincipal *const &  inSR,
art::RunPrincipal *&  outR,
art::SubRunPrincipal *&  outSR,
art::EventPrincipal *&  outE 
)

Definition at line 254 of file LArRawInputDriverShortBo.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().

259  {
260  if (inputfiles_.empty() || nextfile_ == filesdone_) return false;
261 
262  // Create empty result, then fill it from current filename:
263  std::unique_ptr<std::vector<raw::RawDigit>> rdcolsb(new std::vector<raw::RawDigit>);
264 
265  raw::DAQHeader daqHeader;
266  bool firstEventInRun = (nextfile_ == inputfiles_.begin());
267 
268  process_LAr_file(currentDir_, *nextfile_++, *rdcolsb, daqHeader);
269  std::unique_ptr<raw::DAQHeader> daqcolsb(new raw::DAQHeader(daqHeader));
270 
271  art::RunNumber_t rn = daqHeader.GetRun();
272  art::Timestamp tstamp = daqHeader.GetTimeStamp();
273 
274  if (firstEventInRun) {
275  std::unique_ptr<sumdata::RunData> rundatasb(new sumdata::RunData("bo"));
277  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
279  art::put_product_in_principal(std::move(rundatasb), *outR, "daq");
280  }
281  else if (rn != currentSubRunID_.run()) {
282  throw cet::exception("InconsistentEventStream")
283  << "Encountered run #" << rn << " while processing events from run #"
284  << currentSubRunID_.run() << "\n";
285  }
286 
288  currentSubRunID_.run(), currentSubRunID_.subRun(), daqHeader.GetEvent(), tstamp);
289 
290  // Put products in the event.
291  art::put_product_in_principal(std::move(rdcolsb), *outE,
292  "daq"); // Module label
293  art::put_product_in_principal(std::move(daqcolsb), *outE,
294  "daq"); // Module label
295 
296  return true;
297  }
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary subRunAux) const
stringvec_t::const_iterator filesdone_
EventPrincipal * makeEventPrincipal(EventAuxiliary eventAux) const
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={})
stringvec_t::const_iterator nextfile_
unsigned short GetRun() const
Definition: DAQHeader.h:141
unsigned short GetEvent() const
Definition: DAQHeader.h:149
SubRunNumber_t subRun() const
Definition: SubRunID.h:91
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::LArRawInputDriverShortBo::currentDir_
private

Definition at line 53 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

art::SubRunID lris::LArRawInputDriverShortBo::currentSubRunID_
private

Definition at line 57 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

stringvec_t::const_iterator lris::LArRawInputDriverShortBo::filesdone_
private

Definition at line 56 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

stringvec_t lris::LArRawInputDriverShortBo::inputfiles_
private

Definition at line 54 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

stringvec_t::const_iterator lris::LArRawInputDriverShortBo::nextfile_
private

Definition at line 55 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 52 of file LArRawInputDriverShortBo.h.

Referenced by readNext().


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