Public Member Functions | |
TestBeamRawInputDriver (fhicl::ParameterSet const &pset, art::ProductRegistryHelper &help, art::SourceHelper const &pm) | |
void | closeCurrentFile () |
Close currently-open file. More... | |
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) |
void | reconfigure (const fhicl::ParameterSet &pset) |
Protected Member Functions | |
std::string | getDetectorGDML (const int detid) const |
Private Member Functions | |
void | readBeamline () |
read in the beamline files corresponding to the time period of this input file More... | |
LariatFragment * | loadSpillFragments (TBranch *fragBranch, unsigned int index) |
load the artdaq spill fragments from the input file More... | |
std::vector< TDUFragment * > | loadTDUFragments (TBranch *tduBranch, unsigned int index) |
load the artdaq TDU fragments from the input file More... | |
LariatFragment * | getSpillFrag (const SpillWrapper *spillWrapper) |
get the lariat fragment from the artdaq fragments More... | |
BeamlineEvent * | loadBeamlineEvent (unsigned long long tduTime) |
find and load the beamline event which corresponds to a specific TDU timestamp More... | |
Private Attributes | |
art::InputTag | fInputSpillTag |
art::InputTag | fInputTDUTag |
std::string | fConfigName |
std::string | fTriggerName |
std::string | fToFName |
std::string | fWCName |
std::string | fCherenkovName |
std::string | fMuonStackName |
std::string | fPaddleDigitName |
std::string | fWCDigitName |
std::string | fOtherDigitName |
std::string | fSourceName |
std::unique_ptr< daq2raw::BeamlineUnpack > | fBeamlineUnpack |
Algorithm to handle unpacking of beamline data. More... | |
std::unique_ptr< BeamlineEvents > | fBeamlineEvents |
Container to hold all beamline events before matching with detector data. More... | |
std::map< unsigned long long, BeamlineTriggerIndex > | fBeamlineIndex |
Container to index beamline file, spill, trigger and TDU information. More... | |
art::SourceHelper const & | fSourceHelper |
Class to help with {Run, SubRun, Event}Principal construction. More... | |
std::string | fCurrentFilename |
Hang on to the current filename. More... | |
art::SubRunID | fCurrentSubRunID |
Keep track of the current subRun details. More... | |
rawfileparser::RawFileParser | fParser |
Online raw file parsing utility. More... | |
size_t | fMaxEventSize |
Will not try to read an event bigger than this. More... | |
bool | fFilterCorruptedNanoslices |
Filter the corrupted nanaslices in the unpacking? More... | |
bool | fDoFillFlatDAQData |
Do we need to fill FlatDAQData object? More... | |
bool | fFilterBeamlineEvents |
Filter bad beamline events. More... | |
Class to fill the constraints on a template argument to the class, art::Source
Definition at line 117 of file TestBeamRawInputDriver.h.
daq2raw::TestBeamRawInputDriver::TestBeamRawInputDriver | ( | fhicl::ParameterSet const & | pset, |
art::ProductRegistryHelper & | helper, | ||
art::SourceHelper const & | pm | ||
) |
So, how does this work? Good question.
We have two data streams: detector and beamline. Anticipate both beamline and detector files will be data collected over period of ~O(1 hour) (similar to ND), but they will obviously not necessarily overlap. The detector files contain beamline triggers and other (e.g. cosmic) triggers. Beamline triggers will line up with triggers in the beamline files. Other trigger streams are saved in separate output files, so only need to worry about beamline triggers here.
Demonstration (| = trigger):
| || | | | | -------------------------------------— ----— Detector data -----------------— ------------------------— Beamline data | || | | | |
This module is designed to run over a single detector file and assumes the beamline data files which align with this in time are in the working directory. No checks on this are performed nor are any attempts made to look up files in this module.
In order to match and merge the two streams into the same art::Event, the following is performed: – perform an initial scan through the beamline data files to index the file name, spill number and trigger number for each TDU timestamp; – read in the given detector data file and convert to NOvASoft data formatting; – convert the detector data into NOvASoft-formatted offline data products; – for each event, compare TDU timestamp with the timestamps of the beamline events and find corresponding beamline information; – save all the NOvASoft data products within an art::Event.
Definition at line 51 of file TestBeamRawInputDriver.cxx.
References fCherenkovName, fConfigName, fDoFillFlatDAQData, fMuonStackName, fOtherDigitName, fPaddleDigitName, fParser, fSourceName, fToFName, fTriggerName, fWCDigitName, fWCName, art::InEvent, art::InRun, readBeamline(), reconfigure(), art::ProductRegistryHelper::reconstitutes(), and rawfileparser::RawFileParser::setDebug().
void daq2raw::TestBeamRawInputDriver::closeCurrentFile | ( | ) |
Close currently-open file.
Definition at line 119 of file TestBeamRawInputDriver.cxx.
References rawfileparser::RawFileParser::close(), and fParser.
|
protectedinherited |
Definition at line 22 of file NOvAInputDriverBase.cxx.
References daq2raw::NOvAInputDriverBase::fGDMLBase, novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, novadaq::cnv::kTESTBEAM, and string.
Referenced by daq2raw::DAQHit2Raw::beginRun(), daq2raw::NOvARawInputDriver::readNext(), daq2raw::NOvASocketInputDriver::readNext(), and readNext().
|
private |
get the lariat fragment from the artdaq fragments
Get the lariat fragment from the spill wrapper.
Definition at line 239 of file TestBeamRawInputDriver.cxx.
References daq2raw::SpillWrapper::get(), and daq2raw::SpillWrapper::size().
Referenced by loadSpillFragments().
|
private |
find and load the beamline event which corresponds to a specific TDU timestamp
Find and load the beamline event which corresponds to a specific TDU timestamp
Definition at line 322 of file TestBeamRawInputDriver.cxx.
References allTimeWatchdog::endl, art::rootNames::eventTreeName(), fBeamlineIndex, fBeamlineUnpack, daq2raw::BeamlineFileIndex::File, daq2raw::BeamlineEvents::FindEvent(), fInputSpillTag, fInputTDUTag, inFile, loadSpillFragments(), loadTDUFragments(), art::EventAuxiliary::run(), daq2raw::BeamlineSpillIndex::Spill, and daq2raw::BeamlineTriggerIndex::Trigger.
Referenced by readNext().
|
private |
load the artdaq spill fragments from the input file
Load the artdaq fragments.
Definition at line 264 of file TestBeamRawInputDriver.cxx.
References daq2raw::SpillWrapper::add(), allTimeWatchdog::endl, daq2raw::getFragments(), getSpillFrag(), and daq2raw::SpillWrapper::ready().
Referenced by loadBeamlineEvent(), and readBeamline().
|
private |
load the artdaq TDU fragments from the input file
Load the TDU artdaq fragment.
Definition at line 290 of file TestBeamRawInputDriver.cxx.
References elec2geo::block, and daq2raw::getFragments().
Referenced by loadBeamlineEvent(), and readBeamline().
|
private |
read in the beamline files corresponding to the time period of this input file
Read in all the beamline triggers from the beamline data files. Expect all files relevant for this detector data to have been found and placed in this working directory.
Definition at line 127 of file TestBeamRawInputDriver.cxx.
References dir, e, allTimeWatchdog::endl, art::rootNames::eventTreeName(), fBeamlineEvents, fBeamlineIndex, fBeamlineUnpack, file, ConvertToSnowGlobesInput::file_name, compareCafs::files, daq2raw::BeamlineEvents::FindEvent(), fInputSpillTag, fInputTDUTag, daq2raw::BeamlineEvent::GetTDUTime(), inFile, loadSpillFragments(), loadTDUFragments(), make_pair(), next(), daq2raw::BeamlineEvents::NumEvents(), and g4zmq::pwd().
Referenced by TestBeamRawInputDriver().
void daq2raw::TestBeamRawInputDriver::readFile | ( | std::string const & | name, |
art::FileBlock *& | fb | ||
) |
Open the file, "name" and construct and return a new FileBlock object. MUST be successful or throw: art::Exception(art::errors::FileOpenError) or art::Exception(art::errors::FileReadError) are good candidates.
Definition at line 397 of file TestBeamRawInputDriver.cxx.
References errno, fCurrentFilename, fd, art::errors::FileOpenError, fParser, and rawfileparser::RawFileParser::open().
bool daq2raw::TestBeamRawInputDriver::readNext | ( | art::RunPrincipal *const & | inR, |
art::SubRunPrincipal *const & | inSR, | ||
art::RunPrincipal *& | outR, | ||
art::SubRunPrincipal *& | outSR, | ||
art::EventPrincipal *& | outE | ||
) |
Read and fill Run, SubRun and/or Event as might be appropriate.
Define data structures, which will be filled by OnlineUnpack::ProcessRawEvent
Fill the data structures for this event.
Put FlatDAQData object
Definition at line 419 of file TestBeamRawInputDriver.cxx.
References novadaq::timeutils::convertNovaTimeToUnixTime(), geo::GeometryBase::ExtractGDML(), fCherenkovName, fConfigName, fCurrentFilename, fCurrentSubRunID, fDoFillFlatDAQData, daq2raw::OnlineUnpack::fFilterCorruptedNanoslices, fFilterCorruptedNanoslices, fMuonStackName, fOtherDigitName, fPaddleDigitName, fParser, fSourceHelper, fSourceName, fToFName, fTriggerName, rawdata::RawTrigger::fTriggerTimingMarker_TimeStart, fWCDigitName, fWCName, daq2raw::BeamlineEvent::GetCherenkov(), daq2raw::BeamlineEvent::GetConfig(), daq2raw::NOvAInputDriverBase::getDetectorGDML(), daq2raw::OnlineUnpack::getDetId(), daq2raw::OnlineUnpack::getEventNumber(), daq2raw::BeamlineEvent::GetMuonStack(), daq2raw::OnlineUnpack::getRunNumber(), daq2raw::OnlineUnpack::getSubrunNumber(), daq2raw::BeamlineEvent::GetToF(), daq2raw::BeamlineEvent::GetTrigger(), daq2raw::BeamlineEvent::GetWC(), loadBeamlineEvent(), art::SourceHelper::makeEventPrincipal(), art::SourceHelper::makeRunPrincipal(), art::SourceHelper::makeSubRunPrincipal(), daq2raw::OnlineUnpack::ProcessRawEvent(), art::put_product_in_principal(), art::SubRunID::runID(), string, and msf_helper::timespec.
void daq2raw::TestBeamRawInputDriver::reconfigure | ( | const fhicl::ParameterSet & | pset | ) |
Definition at line 90 of file TestBeamRawInputDriver.cxx.
References fCherenkovName, fConfigName, fDoFillFlatDAQData, fFilterBeamlineEvents, fFilterCorruptedNanoslices, fInputSpillTag, fInputTDUTag, fMaxEventSize, fMuonStackName, fOtherDigitName, fPaddleDigitName, fSourceName, fToFName, fTriggerName, fWCDigitName, fWCName, fhicl::ParameterSet::get(), and string.
Referenced by TestBeamRawInputDriver().
|
private |
Container to hold all beamline events before matching with detector data.
Definition at line 171 of file TestBeamRawInputDriver.h.
Referenced by readBeamline().
|
private |
Container to index beamline file, spill, trigger and TDU information.
Definition at line 173 of file TestBeamRawInputDriver.h.
Referenced by loadBeamlineEvent(), and readBeamline().
|
private |
Algorithm to handle unpacking of beamline data.
Definition at line 170 of file TestBeamRawInputDriver.h.
Referenced by loadBeamlineEvent(), and readBeamline().
|
private |
Definition at line 162 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Definition at line 158 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Hang on to the current filename.
Definition at line 176 of file TestBeamRawInputDriver.h.
Referenced by readFile(), and readNext().
|
private |
Keep track of the current subRun details.
Definition at line 177 of file TestBeamRawInputDriver.h.
Referenced by readNext().
|
private |
Do we need to fill FlatDAQData object?
Definition at line 181 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Filter bad beamline events.
Definition at line 182 of file TestBeamRawInputDriver.h.
Referenced by reconfigure().
|
private |
Filter the corrupted nanaslices in the unpacking?
Definition at line 180 of file TestBeamRawInputDriver.h.
Referenced by readNext(), and reconfigure().
|
private |
Definition at line 156 of file TestBeamRawInputDriver.h.
Referenced by loadBeamlineEvent(), readBeamline(), and reconfigure().
|
private |
Definition at line 157 of file TestBeamRawInputDriver.h.
Referenced by loadBeamlineEvent(), readBeamline(), and reconfigure().
|
private |
Will not try to read an event bigger than this.
Definition at line 179 of file TestBeamRawInputDriver.h.
Referenced by reconfigure().
|
private |
Definition at line 163 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Definition at line 166 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Definition at line 164 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Online raw file parsing utility.
Definition at line 178 of file TestBeamRawInputDriver.h.
Referenced by closeCurrentFile(), readFile(), readNext(), and TestBeamRawInputDriver().
|
private |
Class to help with {Run, SubRun, Event}Principal construction.
Definition at line 175 of file TestBeamRawInputDriver.h.
Referenced by readNext().
|
private |
Definition at line 168 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Definition at line 160 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Definition at line 159 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Definition at line 165 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().
|
private |
Definition at line 161 of file TestBeamRawInputDriver.h.
Referenced by readNext(), reconfigure(), and TestBeamRawInputDriver().