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

Member Typedef Documentation

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

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  :
229  principalMaker_(pm)
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_
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();
254  currentSubRunID_ = art::SubRunID();
255 
256  // Fill and return a new Fileblock.
257  fb = new art::FileBlock(art::FileFormatVersion(1, "LArRawInput 2011a"),
258  currentDir_);
259  }
art::SubRunID currentSubRunID_
stringvec_t::const_iterator nextfile_
stringvec_t::const_iterator filesdone_
then echo fcl name
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") );
283  currentSubRunID_ = art::SubRunID(rn, 1);
284  outR = principalMaker_.makeRunPrincipal(rn, tstamp);
285  outSR = principalMaker_.makeSubRunPrincipal(rn,
286  currentSubRunID_.subRun(),
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 
297  outE = principalMaker_.makeEventPrincipal(currentSubRunID_.run(),
298  currentSubRunID_.subRun(),
299  daqHeader.GetEvent(),
300  tstamp);
301 
302  // Put products in the event.
303  art::put_product_in_principal(std::move(rdcol),
304  *outE,
305  "daq"); // Module label
306  art::put_product_in_principal(std::move(daqcol),
307  *outE,
308  "daq"); // Module label
309 
310  return true;
311  }
art::SubRunID currentSubRunID_
stringvec_t::const_iterator nextfile_
art::SourceHelper const & principalMaker_
stringvec_t::const_iterator filesdone_
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::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: