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

Member Typedef Documentation

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

Definition at line 47 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  :
225  principalMaker_(pm)
226  , currentDir_ ()
227  , inputfiles_ ( )
228  , nextfile_ ( inputfiles_.begin() )
229  , filesdone_ ( inputfiles_.end() )
230  , currentSubRunID_ ( )
231  {
232  helper.reconstitutes<raw::DAQHeader, art::InEvent>("daq");
233  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>("daq");
234  helper.reconstitutes<sumdata::RunData, art::InRun> ("daq");
235  }
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 237 of file LArRawInputDriverShortBo.cxx.

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

Definition at line 242 of file LArRawInputDriverShortBo.cxx.

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

244  {
245  // Get the list of event files for this directory.
246  currentDir_ = name;
247  inputfiles_ = getsortedfiles(currentDir_);
248  nextfile_ = inputfiles_.begin();
249  filesdone_ = inputfiles_.end();
251 
252  // Fill and return a new Fileblock.
253  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"),
254  currentDir_);
255  }
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 257 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().

262  {
263  if (inputfiles_.empty() || nextfile_ == filesdone_ ) return false;
264 
265  // Create empty result, then fill it from current filename:
266  std::unique_ptr<std::vector<raw::RawDigit> > rdcolsb ( new std::vector<raw::RawDigit> );
267 
268  raw::DAQHeader daqHeader;
269  bool firstEventInRun = (nextfile_ == inputfiles_.begin());
270 
271  process_LAr_file( currentDir_, *nextfile_++, *rdcolsb, daqHeader );
272  std::unique_ptr<raw::DAQHeader> daqcolsb( new raw::DAQHeader(daqHeader) );
273 
274  art::RunNumber_t rn = daqHeader.GetRun();
275  art::Timestamp tstamp = daqHeader.GetTimeStamp();
276 
277  if (firstEventInRun)
278  {
279  std::unique_ptr<sumdata::RunData> rundatasb(new sumdata::RunData("bo") );
281  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
284  tstamp);
285  art::put_product_in_principal(std::move(rundatasb), *outR, "daq");
286  } else if (rn != currentSubRunID_.run())
287  {
288  throw cet::exception("InconsistentEventStream")
289  << "Encountered run #" << rn
290  << " while processing events from run #" << currentSubRunID_.run()
291  << "\n";
292  }
293 
296  daqHeader.GetEvent(),
297  tstamp);
298 
299  // Put products in the event.
300  art::put_product_in_principal(std::move(rdcolsb),
301  *outE,
302  "daq"); // Module label
303  art::put_product_in_principal(std::move(daqcolsb),
304  *outE,
305  "daq"); // Module label
306 
307  return true;
308  }
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={})
stringvec_t::const_iterator filesdone_
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
Definition: SourceHelper.cc:59
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:36
art::SourceHelper const & principalMaker_
RunNumber_t run() const
Definition: SubRunID.h:84
stringvec_t::const_iterator nextfile_
unsigned short GetRun() const
Definition: DAQHeader.h:105
unsigned short GetEvent() const
Definition: DAQHeader.h:107
SubRunNumber_t subRun() const
Definition: SubRunID.h:90
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::LArRawInputDriverShortBo::currentDir_
private

Definition at line 50 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 54 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 53 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

stringvec_t lris::LArRawInputDriverShortBo::inputfiles_
private

Definition at line 51 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 52 of file LArRawInputDriverShortBo.h.

Referenced by readFile(), and readNext().

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

Definition at line 49 of file LArRawInputDriverShortBo.h.

Referenced by readNext().


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