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::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 28 of file LArRawInputDriverShortBo.h.

Member Typedef Documentation

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

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

234  :
235  principalMaker_(pm)
236  , currentDir_ ()
237  , inputfiles_ ( )
238  , nextfile_ ( inputfiles_.begin() )
239  , filesdone_ ( inputfiles_.end() )
240  , currentSubRunID_ ( )
241  {
242  helper.reconstitutes<raw::DAQHeader, art::InEvent>("daq");
243  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>("daq");
244  helper.reconstitutes<sumdata::RunData, art::InRun> ("daq");
245  }
stringvec_t::const_iterator filesdone_
art::SourceHelper const & principalMaker_
stringvec_t::const_iterator nextfile_

Member Function Documentation

void lris::LArRawInputDriverShortBo::closeCurrentFile ( )

Definition at line 247 of file LArRawInputDriverShortBo.cxx.

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

Definition at line 252 of file LArRawInputDriverShortBo.cxx.

254  {
255  // Get the list of event files for this directory.
256  currentDir_ = name;
257  inputfiles_ = getsortedfiles(currentDir_);
258  nextfile_ = inputfiles_.begin();
259  filesdone_ = inputfiles_.end();
260  currentSubRunID_ = art::SubRunID();
261 
262  // Fill and return a new Fileblock.
263  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"),
264  currentDir_);
265  }
stringvec_t::const_iterator filesdone_
stringvec_t::const_iterator nextfile_
then echo fcl name
bool lris::LArRawInputDriverShortBo::readNext ( art::RunPrincipal *const &  inR,
art::SubRunPrincipal *const &  inSR,
art::RunPrincipal *&  outR,
art::SubRunPrincipal *&  outSR,
art::EventPrincipal *&  outE 
)

Definition at line 267 of file LArRawInputDriverShortBo.cxx.

272  {
273  if (inputfiles_.empty() || nextfile_ == filesdone_ ) return false;
274 
275  // Create empty result, then fill it from current filename:
276  std::unique_ptr<std::vector<raw::RawDigit> > rdcolsb ( new std::vector<raw::RawDigit> );
277 
278  raw::DAQHeader daqHeader;
279  bool firstEventInRun = (nextfile_ == inputfiles_.begin());
280 
281  process_LAr_file( currentDir_, *nextfile_++, *rdcolsb, daqHeader );
282  std::unique_ptr<raw::DAQHeader> daqcolsb( new raw::DAQHeader(daqHeader) );
283 
284  art::RunNumber_t rn = daqHeader.GetRun();
285  art::Timestamp tstamp = daqHeader.GetTimeStamp();
286 
287  if (firstEventInRun)
288  {
289  std::unique_ptr<sumdata::RunData> rundatasb(new sumdata::RunData("bo") );
290  currentSubRunID_ = art::SubRunID(rn, 1);
291  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
292  outSR = principalMaker_.makeSubRunPrincipal(rn,
293  currentSubRunID_.subRun(),
294  tstamp);
295  art::put_product_in_principal(std::move(rundatasb), *outR, "daq");
296  } else if (rn != currentSubRunID_.run())
297  {
298  throw cet::exception("InconsistentEventStream")
299  << "Encountered run #" << rn
300  << " while processing events from run #" << currentSubRunID_.run()
301  << "\n";
302  }
303 
304  outE = principalMaker_.makeEventPrincipal(currentSubRunID_.run(),
305  currentSubRunID_.subRun(),
306  daqHeader.GetEvent(),
307  tstamp);
308 
309  // Put products in the event.
310  art::put_product_in_principal(std::move(rdcolsb),
311  *outE,
312  "daq"); // Module label
313  art::put_product_in_principal(std::move(daqcolsb),
314  *outE,
315  "daq"); // Module label
316 
317  return true;
318  }
stringvec_t::const_iterator filesdone_
art::SourceHelper const & principalMaker_
stringvec_t::const_iterator nextfile_
unsigned short GetRun() const
Definition: DAQHeader.h:103
unsigned short GetEvent() const
Definition: DAQHeader.h:105
time_t GetTimeStamp() const
Definition: DAQHeader.h:106

Member Data Documentation

std::string lris::LArRawInputDriverShortBo::currentDir_
private

Definition at line 52 of file LArRawInputDriverShortBo.h.

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

Definition at line 56 of file LArRawInputDriverShortBo.h.

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

Definition at line 55 of file LArRawInputDriverShortBo.h.

stringvec_t lris::LArRawInputDriverShortBo::inputfiles_
private

Definition at line 53 of file LArRawInputDriverShortBo.h.

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

Definition at line 54 of file LArRawInputDriverShortBo.h.

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

Definition at line 51 of file LArRawInputDriverShortBo.h.


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