Public Member Functions | Private Types | Private Attributes | List of all members
lris::LArRawInputDriver Class Reference

#include <LArRawInputDriver.h>

Public Member Functions

 LArRawInputDriver (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::stringstringvec_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 LArRawInputDriver.h.

Member Typedef Documentation

Definition at line 49 of file LArRawInputDriver.h.

Constructor & Destructor Documentation

lris::LArRawInputDriver::LArRawInputDriver ( 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 225 of file LArRawInputDriver.cxx.

228  :
230  , currentDir_ ()
231  , inputfiles_ ( )
232  , nextfile_ ( inputfiles_.begin() )
233  , filesdone_ ( inputfiles_.end() )
234  , currentSubRunID_ ( )
235  {
236  helper.reconstitutes<raw::DAQHeader, art::InEvent>("daq");
237  helper.reconstitutes<std::vector<raw::RawDigit>, art::InEvent>("daq");
238  helper.reconstitutes<sumdata::RunData, art::InRun> ("daq");
239  }
art::SubRunID currentSubRunID_
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::LArRawInputDriver::closeCurrentFile ( )

Definition at line 241 of file LArRawInputDriver.cxx.

242  {
243  // Nothing to do (See EventFileSentry).
244  }
void lris::LArRawInputDriver::readFile ( std::string const &  name,
art::FileBlock *&  fb 
)

Definition at line 246 of file LArRawInputDriver.cxx.

248  {
249  // Get the list of event files for this directory.
250  currentDir_ = name;
251  inputfiles_ = getsortedfiles(currentDir_);
252  nextfile_ = inputfiles_.begin();
253  filesdone_ = inputfiles_.end();
255 
256  // Fill and return a new Fileblock.
257  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"),
258  currentDir_);
259  }
static QCString name
Definition: declinfo.cpp:673
art::SubRunID currentSubRunID_
stringvec_t::const_iterator nextfile_
stringvec_t::const_iterator filesdone_
bool lris::LArRawInputDriver::readNext ( art::RunPrincipal *const &  inR,
art::SubRunPrincipal *const &  inSR,
art::RunPrincipal *&  outR,
art::SubRunPrincipal *&  outSR,
art::EventPrincipal *&  outE 
)

Definition at line 261 of file LArRawInputDriver.cxx.

266  {
267  if (inputfiles_.empty() || nextfile_ == filesdone_ ) return false;
268 
269  // Create empty result, then fill it from current filename:
270  std::unique_ptr<std::vector<raw::RawDigit> > rdcol ( new std::vector<raw::RawDigit> );
271 
272  raw::DAQHeader daqHeader;
273  bool firstEventInRun = (nextfile_ == inputfiles_.begin());
274 
275  process_LAr_file( currentDir_, *nextfile_++, *rdcol, daqHeader );
276  std::unique_ptr<raw::DAQHeader> daqcol( new raw::DAQHeader(daqHeader) );
277 
278  art::RunNumber_t rn = daqHeader.GetRun();
279  art::Timestamp tstamp = daqHeader.GetTimeStamp();
280 
281  if (firstEventInRun){
282  std::unique_ptr<sumdata::RunData> rundata(new sumdata::RunData("argoneut") );
284  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
287  tstamp);
288  art::put_product_in_principal(std::move(rundata), *outR, "daq");
289  }
290  else if (rn != currentSubRunID_.run()){
291  throw cet::exception("InconsistentEventStream")
292  << "Encountered run #" << rn
293  << " while processing events from run #" << currentSubRunID_.run()
294  << "\n";
295  }
296 
299  daqHeader.GetEvent(),
300  tstamp);
301 
302  // Put products in the event.
304  *outE,
305  "daq"); // Module label
307  *outE,
308  "daq"); // Module label
309 
310  return true;
311  }
art::SubRunID currentSubRunID_
stringvec_t::const_iterator nextfile_
SubRunPrincipal * makeSubRunPrincipal(SubRunAuxiliary const &subRunAux) const
art::SourceHelper const & principalMaker_
RunPrincipal * makeRunPrincipal(RunAuxiliary const &runAux) const
Definition: SourceHelper.cc:92
def move(depos, offset)
Definition: depos.py:107
RunNumber_t run() const
Definition: SubRunID.h:85
stringvec_t::const_iterator filesdone_
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={})
unsigned short GetRun() const
Definition: DAQHeader.h:103
unsigned short GetEvent() const
Definition: DAQHeader.h:105
EventPrincipal * makeEventPrincipal(EventAuxiliary const &eventAux, std::unique_ptr< History > &&history) const
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:106
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:120

Member Data Documentation

std::string lris::LArRawInputDriver::currentDir_
private

Definition at line 52 of file LArRawInputDriver.h.

art::SubRunID lris::LArRawInputDriver::currentSubRunID_
private

Definition at line 56 of file LArRawInputDriver.h.

stringvec_t::const_iterator lris::LArRawInputDriver::filesdone_
private

Definition at line 55 of file LArRawInputDriver.h.

stringvec_t lris::LArRawInputDriver::inputfiles_
private

Definition at line 53 of file LArRawInputDriver.h.

stringvec_t::const_iterator lris::LArRawInputDriver::nextfile_
private

Definition at line 54 of file LArRawInputDriver.h.

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

Definition at line 51 of file LArRawInputDriver.h.


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