All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
icarus::DaqDecoderICARUSPMT Class Reference

Produces raw::OpDetWaveform from V1730 artDAQ data fragments. More...

Inheritance diagram for icarus::DaqDecoderICARUSPMT:

Classes

struct  BoardSetupConfig
 Configuration of the V1730 readout board setup. More...
 
struct  Config
 Main module configuration. More...
 
struct  FragmentInfo_t
 Collection of useful information from fragment data. More...
 
struct  NeededBoardInfo_t
 Information used in decoding from a board. More...
 
struct  ProtoWaveform_t
 All the information collected about a waveform (with the waveform itself). More...
 
struct  SplitTimestamp_t
 Data structure for trigger time. More...
 
struct  TreeData_EventID_t
 Data structure for basic event information in simple ROOT trees. More...
 
struct  TreeFragment_t
 Structure collecting all data for a fragment ROOT tree. More...
 
struct  TriggerInfo_t
 Collection of information about the global trigger. More...
 

Public Types

using nanoseconds = util::quantities::intervals::nanoseconds
 Alias. More...
 
using Parameters = art::EDProducer::Table< Config >
 

Public Member Functions

 DaqDecoderICARUSPMT (Parameters const &params)
 Constructor. More...
 
void beginRun (art::Run &run) override
 On a new run: cache PMT configuration information. More...
 
void produce (art::Event &event) override
 Processes the event. More...
 
void endJob () override
 Prints a end-of-job message. More...
 

Static Public Attributes

static constexpr electronics_time NoTimestamp = std::numeric_limits<electronics_time>::min()
 

Private Types

enum  DataTrees : std::size_t { DataTrees::Fragments, DataTrees::N }
 Enumerate the supported data trees. More...
 
using TreeNameList_t = std::array< std::string, static_cast< std::size_t >(DataTrees::N)>
 
using AllChannelSetup_t = daq::details::BoardSetup_t::AllChannelSetup_t
 Type of setup of all channels in a readout board. More...
 
using BoardID_t = short int
 Type used internally to represent board ID. More...
 

Private Member Functions

bool hasPMTconfiguration () const
 Returns whether PMT configuration information is expected to be available. More...
 
bool UpdatePMTConfiguration (sbn::PMTconfiguration const *PMTconfig)
 Updates the PMT configuration cache. How? Dunno. Placeholder. More...
 
daq::details::BoardInfoLookup matchBoardConfigurationAndSetup (sbn::PMTconfiguration const *PMTconfig) const
 Returns a lookup object with board setup and configuration info. More...
 
NeededBoardInfo_t fetchNeededBoardInfo (daq::details::BoardInfoLookup::BoardInfo_t const *boardInfo, unsigned int fragmentID) const
 Puts together all the needed information for a board. More...
 
TriggerInfo_t fetchTriggerTimestamp (art::Event const &event) const
 Retrieves the global trigger time stamp from the event. More...
 
electronics_time fragmentWaveformTimestamp (FragmentInfo_t const &fragInfo, NeededBoardInfo_t const &boardInfo, SplitTimestamp_t triggerTime) const
 Returns the timestamp for the waveforms in the specified fragment. More...
 
electronics_time fragmentWaveformTimestampOnTrigger (FragmentInfo_t const &fragInfo, NeededBoardInfo_t const &boardInfo, SplitTimestamp_t triggerTime) const
 Returns the timestamp for the waveforms in the specified fragment. More...
 
electronics_time fragmentWaveformTimestampFromTTT (FragmentInfo_t const &fragInfo, NeededBoardInfo_t const &boardInfo, SplitTimestamp_t triggerTime) const
 Returns the timestamp for the waveforms in the specified fragment. More...
 
artdaq::Fragments const & readInputFragments (art::Event const &event) const
 Reads the fragments to be processed. More...
 
void checkFragmentType (artdaq::Fragment const &artdaqFragment) const
 Throws an exception if artdaqFragment is not of type CAEN1730. More...
 
artdaq::FragmentPtrs makeFragmentCollection (artdaq::Fragment const &sourceFragment) const
 
artdaq::FragmentPtrs makeFragmentCollectionFromFragment (artdaq::Fragment const &sourceFragment) const
 Converts a plain fragment into a fragment collection. More...
 
artdaq::FragmentPtrs makeFragmentCollectionFromContainerFragment (artdaq::Fragment const &sourceFragment) const
 Converts a container fragment into a fragment collection. More...
 
std::vector< ProtoWaveform_tprocessBoardFragments (artdaq::FragmentPtrs const &artdaqFragment, TriggerInfo_t const &triggerInfo)
 Extracts waveforms from the specified fragments from a board. More...
 
unsigned int mergeWaveforms (std::vector< ProtoWaveform_t > &waveforms) const
 
void sortWaveforms (std::vector< ProtoWaveform_t > &waveforms) const
 Sorts in place the specified waveforms in channel order, then in time. More...
 
std::vector< ProtoWaveform_t
const * > 
findWaveformsWithNominalTrigger (std::vector< ProtoWaveform_t > const &waveforms) const
 Returns pointers to all waveforms including the nominal trigger time. More...
 
bool containsGlobalTrigger (raw::OpDetWaveform const &waveform) const
 Returns whether waveform includes the tick of the nominal trigger time. More...
 
bool containsGlobalTrigger (electronics_time time, std::size_t nTicks) const
 Returns whether nominal trigger time is within nTicks from time. More...
 
ProtoWaveform_t mergeWaveformGroup (std::vector< ProtoWaveform_t > &allWaveforms, std::vector< std::size_t > const &indices) const
 
electronics_time waveformStartTime (raw::OpDetWaveform const &wf) const
 
electronics_time waveformStartTime (ProtoWaveform_t const &wf) const
 
electronics_time waveformEndTime (raw::OpDetWaveform const &wf) const
 
electronics_time waveformEndTime (ProtoWaveform_t const &wf) const
 
std::vector< ProtoWaveform_tprocessFragment (artdaq::Fragment const &artdaqFragment, NeededBoardInfo_t const &boardInfo, TriggerInfo_t const &triggerInfo)
 Create waveforms and fills trees for the specified artDAQ fragment. More...
 
std::vector< ProtoWaveform_tcreateFragmentWaveforms (FragmentInfo_t const &fragInfo, AllChannelSetup_t const &channelSetup, electronics_time const timeStamp) const
 Creates raw::OpDetWaveform objects from the fragment data. More...
 
FragmentInfo_t extractFragmentInfo (artdaq::Fragment const &artdaqFragment) const
 Extracts useful information from fragment data. More...
 
NeededBoardInfo_t neededBoardInfo (artdaq::Fragment::fragment_id_t fragment_id) const
 Returns the board information for this fragment. More...
 
std::set< std::string > getAllInstanceNames () const
 Returns all the instance names we will produce. More...
 
void checkBoardSetup (std::vector< daq::details::BoardSetup_t > const &allBoardSetup) const
 Throws an exception if the configuration of boards shows errors. More...
 
void usesEventInfo ()
 Declares the use of event information. More...
 
void initTrees (std::vector< std::string > const &treeNames)
 Initializes all requested data trees. More...
 
void initEventIDtree (TTree &tree, TreeData_EventID_t &data)
 Initializes the event ID part of a tree. More...
 
void initFragmentsTree ()
 Initializes the fragment data tree (fTreeFragment). More...
 
void fillTreeEventID (art::Event const &event, TreeData_EventID_t &treeData) const
 Fills the base information of a tree data entry from an art event. More...
 
void assignEventInfo (TreeData_EventID_t &treeData) const
 Assigns the cached event information to the specified tree data. More...
 
void fillPMTfragmentTree (FragmentInfo_t const &fragInfo, TriggerInfo_t const &triggerInfo, electronics_time waveformTimestamp)
 

Static Private Member Functions

static std::string listTreeNames (std::string const &sep="\n")
 Returns a string with all supported tree names. More...
 
static unsigned int extractTriggerTimeTag (artdaq::Fragment const &fragment)
 Extracts the Trigger Time Tag (31+1 bits) value from the fragment. More...
 
template<std::size_t NBits, typename T >
static constexpr std::pair
< std::array< std::size_t,
NBits >, std::size_t > 
setBitIndices (T value) noexcept
 Returns the count of set bits for each set bit. More...
 
static long long int timestampDiff (std::uint64_t a, std::uint64_t b)
 Returns the timestamp difference a - b. More...
 
static constexpr std::size_t effectivePMTboardFragmentID (artdaq::Fragment::fragment_id_t id)
 Returns the fragment ID to be used with databases. More...
 
static BoardID_t extractFragmentBoardID (artdaq::Fragment const &fragment)
 Extracts the fragment ID (i.e. board ID) from the specified fragment. More...
 
static std::string const & treeName (DataTrees treeID)
 Returns the name of the specified tree. More...
 
static TreeNameList_t initTreeNames ()
 Static initialization. More...
 

Private Attributes

std::vector< art::InputTag > const fInputTags
 < List of candidate data products with artDAQ data fragments. More...
 
bool const fSurviveExceptions
 Whether to "ignore" errors. More...
 
bool const fDiagnosticOutput
 If true will spew endless messages to output. More...
 
bool const fPacketDump
 Dump V1730 data. More...
 
bool const fRequireKnownBoards
 Whether info on all input boards is required. More...
 
bool const fRequireBoardConfig
 Whether setup info on all boards is required. More...
 
std::optional< art::InputTag >
const 
fPMTconfigTag
 Input tag of the PMT configuration. More...
 
std::optional< art::InputTag >
const 
fTriggerTag
 Input tag of the global trigger. More...
 
bool const fTTTresetEverySecond
 Whether V1730 TTT is reset every second. More...
 
std::vector
< daq::details::BoardSetup_t >
const 
fBoardSetup
 All board setup settings. More...
 
bool const fSkipWaveforms
 Whether to skip waveform decoding. More...
 
bool const fDropRawDataAfterUse
 Clear fragment data product cache after use. More...
 
std::string const fLogCategory
 Message facility category. More...
 
detinfo::DetectorTimings const fDetTimings
 Interface to LArSoft configuration for detector timing. More...
 
icarusDB::IICARUSChannelMap const & fChannelMap
 Fragment/channel mapping database. More...
 
nanoseconds const fOpticalTick
 Duration of the optical detector readout sampling tick (i.e. 2 ns; hush!). More...
 
electronics_time const fNominalTriggerTime
 Trigger time as reported by detinfo::DetectorClocks service. More...
 
std::optional
< daq::details::BoardInfoLookup
fBoardInfoLookup
 Find the information on a readout boards by fragment ID. More...
 
unsigned int fNFailures = 0U
 Number of event failures encountered. More...
 
std::unique_ptr
< TreeData_EventID_t
fEventInfo
 Event ID for trees. More...
 
std::unique_ptr< TreeFragment_tfTreeFragment
 
util::ArtHandleTrackerManager
< art::Event > 
fDataCacheRemover
 Tracks art data products and removes their cached data on demand. More...
 

Static Private Attributes

static TreeNameList_t const TreeNames = icarus::DaqDecoderICARUSPMT::initTreeNames()
 

Friends

struct dumpChannel
 
std::ostream & operator<< (std::ostream &, ProtoWaveform_t const &)
 

Detailed Description

Produces raw::OpDetWaveform from V1730 artDAQ data fragments.

The module can read fragments from CAEN V1730 readout boards delivered by artDAQ. It produces optical detector waveforms in LArSoft standards.

This decoder must support both a off-line mode (for storage and downstream processing) and a on-line mode (for monitoring). In particular, the on-line workflow is such that it may not be possible to access the FHiCL configuration of the job and therefore the PMT configuration data (see icarus::PMTconfigurationExtraction module).

Configuration

The set of supported parameters can be seen on command line by running lar --print-description DaqDecoderICARUSPMT.

Description of the configuration parameters:

Requirements

Services required include:

Waveform time stamp

All waveforms on the same readout board fragment share the same timestamp. The same readout board can produce different fragments at different times within an event in which case each fragment will be independently assigned a timstamp .

The time stamp of the waveform is defined as the time when the first sample of the waveform started (that is, if the sample represent the value of the signal in an interval of 2 ns, the time stamp is pointing at the beginning of those 2 ns). Whether we can honour that definition, though, is a different matter. The representation of the time stamp is in the electronics time scale.

Waveforms all originate from a trigger primitive signal being sent to the readout boards by NI7820 FPGA to start the acquisition of the waveform. One of these primitives matches the global event trigger, but the corresponding fragment is not treated in any special way. Every delay between when that signal is emitted and when the PMT trigger is executed shifts the timestamp of the waveform backward.

We assign the the time stamp of the waveforms as follow:

  1. the base time is the global trigger time; the global trigger time is read from the trigger data, where it is stored as an absolute time in TAI scale; the global trigger time itself effectively defines the electronics time scale used within a art event, so its representation is a fixed number that is configured in LArSoft and can be accessed with DetectorClocksData::TriggerTime();
  2. each V1730 data fragment comes with a time tag ("TTT") describing the time of the end of the readout buffer (unknown whether the start or the end of the tick of the last sample). This tag is a counter internal to the V1730 board, incremented every 8 ns. The counter is reset at the beginning of every "new" TAI second, and it can thus be easily transformed into a time in the same TAI scale as the global trigger; the difference between TTT and the global trigger pins down the end of the readout buffer in the electronics time scale;
  3. a delay is subtracted to the timestamp, which encompasses all fixed delays occurring in the trigger signal transportation; the most prominent is the delay occurring between the start of the "new" TAI second and when the TTT reset signal reaches and is honoured by the readout board. This value must be independently measured and provided to this decoder via configuration as setup information (TTTresetDelay); if not present in the setup, this delay is not added;
  4. finally, the time of the beginning of the waveform, that is the target for raw::OpDetWaveform timestamp, is obtained from the time of its end by simply subtracting the readout buffer length.

A special decoding mode, hoped to be just historical by now, does not rely on the global trigger time. This mode can be safely used only when the (only) data fragment was triggered by the global trigger (e.g. in the simplest minimum/zero bias trigger). It has the advantage that it does not use the TTT information. It can be enabled explicitly by setting the option TTTresetEverySecond to true, or by removing the specification of the trigger time data product tag (TriggerTag).

  1. The trigger primitive time is assumed to be the global trigger time too, so that the trigger primitive time in electronics time also matches the global trigger time.
  2. upon receiving the trigger primitive signal, the readout board will keep some of the samples already digitized, in what we call pre-trigger buffer; the size of this buffer is a fixed number of samples which is specified in DAQ as a fraction of the complete buffer that is post-trigger; this amount, converted in time, is subtracted to the trigger time to point back to the beginning of the waveform instead that to the trigger primitive time. The necessary information is read from the PMT configuration (PMTconfigTag); if no configuration is available, this offset is not subtracted; note that this is a major shift (typically, a few microseconds) that should be always included. This step is equivalent to the step (4) of the regular mode, where here the adjustment starts from the trigger primitive time instead than from the end-of-buffer time.
  3. a delay is subtracted to the timestamp, which encompasses all fixed delays occurring in the trigger signal transportation; one component of it is the relative delay in the propagation of the trigger primitive signal from a board to the next (in fact, every three boards have the trigger signal in daisy chain). This value must be independently measured and provided to this decoder via configuration as setup information (TriggerDelay); if not present in the setup, this delay is not added. Note that the particular contribution of the daisy chain to the delay does not need to be explicitly taken into account in the main mode, because the TTT reset is independent and not daisy-chained, so that the TTT times are all synchronized and when the primitive trigger arrives (via daisy chain) the TTT value at that instant is already including the delay.

Data trees

The module supports the following ROOT trees production on demand:

Technical notes

In order to correctly reconstruct the time stamp, this module needs several pieces of information. These include the size of the pre-trigger buffer, which is set by the readout board configuration, and the delay either between the start of the "new" second and the execution of the TTT reset, or between the global trigger and the time that trigger is received and acted upon in the readout board, depending of the time stamping mode; in both cases, the delays need to be measured. The first category of information, from readout board configuration, are read from the input file (sbn::PMTconfiguration), while the second category needs to be specified in the module FHiCL configuration.

PMT configuration is optional, in the sense that it can be omitted; in that case, some standard values will be used for it. This kind of setup may be good for monitoring, but it does not meet the requirements for physics analyses. For a board to be served, an entry of that board must be present in the module configuration (BoardSetup). It is an error for a fragment in input not to have an entry for the corresponding board setup.

The module extracts the needed information and matches it into a sort-of-database keyed by fragment ID, so that it can be quickly applied when decoding a fragment. The matching is performed by board name.

Proto-waveforms

The module has grown complex enough that some decisions need to be taken much later after a waveform is created, but using information available only during the creation. For example, a waveform can be ultimately routed to a different data product depending on which readout board it comes from, but that information is lost by the time the waveform needs to be written. Rather than attempting to recreate that information, it is saved when still available and travels together with the waveform itself in a data structure called "proto-waveform". The extra-information is eventually discarded when putting the actual waveform into the art event.

Processing pipeline

Processing happens according to the following structure (in produce()):

  1. pre-processing: currently nothing
  2. processing of each board data independently: at this level, all the buffers from the 16 channels of a single board are processed together (processBoardFragments())
    1. the configuration and parameters specific to this board are fetched
    2. each data fragment is processed independently: at this level, data from all 16 channels at a given time are processed together, producing up to 16 proto-waveforms
    3. merging of contiguous waveforms is performed
  3. post-processing of proto-waveforms:
    • sorting by time (as opposed as roughly by channel, as they come)
  4. conversion to data products and output

Glossary

Definition at line 406 of file DaqDecoderICARUSPMT_module.cc.

Member Typedef Documentation

Type of setup of all channels in a readout board.

Definition at line 658 of file DaqDecoderICARUSPMT_module.cc.

using icarus::DaqDecoderICARUSPMT::BoardID_t = short int
private

Type used internally to represent board ID.

Definition at line 1046 of file DaqDecoderICARUSPMT_module.cc.

Alias.

Definition at line 428 of file DaqDecoderICARUSPMT_module.cc.

using icarus::DaqDecoderICARUSPMT::Parameters = art::EDProducer::Table<Config>

Definition at line 632 of file DaqDecoderICARUSPMT_module.cc.

using icarus::DaqDecoderICARUSPMT::TreeNameList_t = std::array<std::string, static_cast<std::size_t>(DataTrees::N)>
private

Definition at line 416 of file DaqDecoderICARUSPMT_module.cc.

Member Enumeration Documentation

enum icarus::DaqDecoderICARUSPMT::DataTrees : std::size_t
strongprivate

Enumerate the supported data trees.

Enumerator
Fragments 

Information about fragments.

N 

Counter.

Definition at line 411 of file DaqDecoderICARUSPMT_module.cc.

411  : std::size_t {
412  Fragments, ///< Information about fragments
413  N ///< Counter.
414  };
process_name largeant stream1 can override from command line with o or output physics producers generator N

Constructor & Destructor Documentation

icarus::DaqDecoderICARUSPMT::DaqDecoderICARUSPMT ( Parameters const &  params)
explicit

Constructor.

Definition at line 1330 of file DaqDecoderICARUSPMT_module.cc.

1331  : art::EDProducer(params)
1332  , fInputTags{ params().FragmentsLabels() }
1333  , fSurviveExceptions{ params().SurviveExceptions() }
1334  , fDiagnosticOutput{ params().DiagnosticOutput() }
1335  , fPacketDump{ params().PacketDump() }
1336  , fRequireKnownBoards{ params().RequireKnownBoards() }
1337  , fRequireBoardConfig{ params().RequireBoardConfig() }
1338  , fPMTconfigTag{ params().PMTconfigTag() }
1339  , fTriggerTag{ params().TriggerTag() }
1341  { params().TTTresetEverySecond().value_or(fTriggerTag.has_value()) }
1342  , fBoardSetup{ params().BoardSetup() }
1343  , fSkipWaveforms{ params().SkipWaveforms() }
1344  , fDropRawDataAfterUse{ params().DropRawDataAfterUse() }
1345  , fLogCategory{ params().LogCategory() }
1346  , fDetTimings
1347  { art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob() }
1348  , fChannelMap{ *(art::ServiceHandle<icarusDB::IICARUSChannelMap const>{}) }
detinfo::DetectorTimings const fDetTimings
Interface to LArSoft configuration for detector timing.
std::vector< daq::details::BoardSetup_t > const fBoardSetup
All board setup settings.
bool const fSurviveExceptions
Whether to &quot;ignore&quot; errors.
bool const fRequireKnownBoards
Whether info on all input boards is required.
bool const fDropRawDataAfterUse
Clear fragment data product cache after use.
std::vector< art::InputTag > const fInputTags
&lt; List of candidate data products with artDAQ data fragments.
bool const fDiagnosticOutput
If true will spew endless messages to output.
std::string const fLogCategory
Message facility category.
icarusDB::IICARUSChannelMap const & fChannelMap
Fragment/channel mapping database.
std::optional< art::InputTag > const fTriggerTag
Input tag of the global trigger.
bool const fRequireBoardConfig
Whether setup info on all boards is required.
bool const fTTTresetEverySecond
Whether V1730 TTT is reset every second.
bool const fPacketDump
Dump V1730 data.
std::optional< art::InputTag > const fPMTconfigTag
Input tag of the PMT configuration.
bool const fSkipWaveforms
Whether to skip waveform decoding.

Member Function Documentation

void icarus::DaqDecoderICARUSPMT::assignEventInfo ( TreeData_EventID_t treeData) const
private

Assigns the cached event information to the specified tree data.

void icarus::DaqDecoderICARUSPMT::beginRun ( art::Run &  run)
override

On a new run: cache PMT configuration information.

void icarus::DaqDecoderICARUSPMT::checkBoardSetup ( std::vector< daq::details::BoardSetup_t > const &  allBoardSetup) const
private

Throws an exception if the configuration of boards shows errors.

void icarus::DaqDecoderICARUSPMT::checkFragmentType ( artdaq::Fragment const &  artdaqFragment) const
private

Throws an exception if artdaqFragment is not of type CAEN1730.

bool icarus::DaqDecoderICARUSPMT::containsGlobalTrigger ( raw::OpDetWaveform const &  waveform) const
private

Returns whether waveform includes the tick of the nominal trigger time.

bool icarus::DaqDecoderICARUSPMT::containsGlobalTrigger ( electronics_time  time,
std::size_t  nTicks 
) const
private

Returns whether nominal trigger time is within nTicks from time.

std::vector<ProtoWaveform_t> icarus::DaqDecoderICARUSPMT::createFragmentWaveforms ( FragmentInfo_t const &  fragInfo,
AllChannelSetup_t const &  channelSetup,
electronics_time const  timeStamp 
) const
private

Creates raw::OpDetWaveform objects from the fragment data.

Parameters
fragInfoinformation extracted from the fragment
channelSetupsettings channel by channel
timeStamptimestamp of the waveforms in the fragment
Returns
collection of newly created raw::OpDetWaveform

All fragment information needed is enclosed in fragInfo (extractFragmentInfo()). The timestamp can be obtained with a call to fragmentWaveformTimestamp().

static constexpr std::size_t icarus::DaqDecoderICARUSPMT::effectivePMTboardFragmentID ( artdaq::Fragment::fragment_id_t  id)
inlinestaticprivate

Returns the fragment ID to be used with databases.

Definition at line 966 of file DaqDecoderICARUSPMT_module.cc.

967  { return id & 0x0fff; }
void icarus::DaqDecoderICARUSPMT::endJob ( )
override

Prints a end-of-job message.

static BoardID_t icarus::DaqDecoderICARUSPMT::extractFragmentBoardID ( artdaq::Fragment const &  fragment)
staticprivate

Extracts the fragment ID (i.e. board ID) from the specified fragment.

FragmentInfo_t icarus::DaqDecoderICARUSPMT::extractFragmentInfo ( artdaq::Fragment const &  artdaqFragment) const
private

Extracts useful information from fragment data.

static unsigned int icarus::DaqDecoderICARUSPMT::extractTriggerTimeTag ( artdaq::Fragment const &  fragment)
staticprivate

Extracts the Trigger Time Tag (31+1 bits) value from the fragment.

NeededBoardInfo_t icarus::DaqDecoderICARUSPMT::fetchNeededBoardInfo ( daq::details::BoardInfoLookup::BoardInfo_t const *  boardInfo,
unsigned int  fragmentID 
) const
private

Puts together all the needed information for a board.

TriggerInfo_t icarus::DaqDecoderICARUSPMT::fetchTriggerTimestamp ( art::Event const &  event) const
private

Retrieves the global trigger time stamp from the event.

void icarus::DaqDecoderICARUSPMT::fillPMTfragmentTree ( FragmentInfo_t const &  fragInfo,
TriggerInfo_t const &  triggerInfo,
electronics_time  waveformTimestamp 
)
private

Fills the PMT fragment tree with the specified information (additional information needs to have been set already).

void icarus::DaqDecoderICARUSPMT::fillTreeEventID ( art::Event const &  event,
TreeData_EventID_t treeData 
) const
private

Fills the base information of a tree data entry from an art event.

std::vector<ProtoWaveform_t const*> icarus::DaqDecoderICARUSPMT::findWaveformsWithNominalTrigger ( std::vector< ProtoWaveform_t > const &  waveforms) const
private

Returns pointers to all waveforms including the nominal trigger time.

electronics_time icarus::DaqDecoderICARUSPMT::fragmentWaveformTimestamp ( FragmentInfo_t const &  fragInfo,
NeededBoardInfo_t const &  boardInfo,
SplitTimestamp_t  triggerTime 
) const
private

Returns the timestamp for the waveforms in the specified fragment.

electronics_time icarus::DaqDecoderICARUSPMT::fragmentWaveformTimestampFromTTT ( FragmentInfo_t const &  fragInfo,
NeededBoardInfo_t const &  boardInfo,
SplitTimestamp_t  triggerTime 
) const
private

Returns the timestamp for the waveforms in the specified fragment.

This method assumes that the Trigger Time Tag counters are synchronised with the global trigger and their value is reset on each new second of the global trigger timescale (International Atomic Time).

This assumptions enables timestamping of waveforms from the same readout boards at different times ("multi-window PMT readout").

See TTTresetEverySecond configuration option.

electronics_time icarus::DaqDecoderICARUSPMT::fragmentWaveformTimestampOnTrigger ( FragmentInfo_t const &  fragInfo,
NeededBoardInfo_t const &  boardInfo,
SplitTimestamp_t  triggerTime 
) const
private

Returns the timestamp for the waveforms in the specified fragment.

This method assumes that all PMT readout board triggers happened at the same time as the global trigger. Unsurprisingly, this does not work well with multiple PMT windows.

std::set<std::string> icarus::DaqDecoderICARUSPMT::getAllInstanceNames ( ) const
private

Returns all the instance names we will produce.

bool icarus::DaqDecoderICARUSPMT::hasPMTconfiguration ( ) const
inlineprivate

Returns whether PMT configuration information is expected to be available.

Definition at line 797 of file DaqDecoderICARUSPMT_module.cc.

797 { return fPMTconfigTag.has_value(); }
std::optional< art::InputTag > const fPMTconfigTag
Input tag of the PMT configuration.
void icarus::DaqDecoderICARUSPMT::initEventIDtree ( TTree &  tree,
TreeData_EventID_t data 
)
private

Initializes the event ID part of a tree.

void icarus::DaqDecoderICARUSPMT::initFragmentsTree ( )
private

Initializes the fragment data tree (fTreeFragment).

auto icarus::DaqDecoderICARUSPMT::initTreeNames ( )
staticprivate

Static initialization.

Definition at line 1300 of file DaqDecoderICARUSPMT_module.cc.

1300  {
1302  names[static_cast<std::size_t>(DataTrees::Fragments)] = "PMTfragments";
1303  return names;
1304 } // icarus::DaqDecoderICARUSPMT::initTreeNames()
std::array< std::string, static_cast< std::size_t >(DataTrees::N)> TreeNameList_t
static const std::vector< std::string > names
void icarus::DaqDecoderICARUSPMT::initTrees ( std::vector< std::string > const &  treeNames)
private

Initializes all requested data trees.

std::string icarus::DaqDecoderICARUSPMT::listTreeNames ( std::string const &  sep = "\n")
staticprivate

Returns a string with all supported tree names.

Definition at line 1314 of file DaqDecoderICARUSPMT_module.cc.

1315 {
1316  std::string l;
1317  for (std::string const& name: TreeNames) {
1318  if (!l.empty()) l += sep;
1319  l += '\'';
1320  l += name;
1321  l += '\'';
1322  } // for
1323  return l;
1324 } // icarus::DaqDecoderICARUSPMT::listTreeNames()
then echo fcl name
static TreeNameList_t const TreeNames
artdaq::FragmentPtrs icarus::DaqDecoderICARUSPMT::makeFragmentCollection ( artdaq::Fragment const &  sourceFragment) const
private

Converts a fragment into a fragment collection (dispatcher based on fragment type).

artdaq::FragmentPtrs icarus::DaqDecoderICARUSPMT::makeFragmentCollectionFromContainerFragment ( artdaq::Fragment const &  sourceFragment) const
private

Converts a container fragment into a fragment collection.

artdaq::FragmentPtrs icarus::DaqDecoderICARUSPMT::makeFragmentCollectionFromFragment ( artdaq::Fragment const &  sourceFragment) const
private

Converts a plain fragment into a fragment collection.

daq::details::BoardInfoLookup icarus::DaqDecoderICARUSPMT::matchBoardConfigurationAndSetup ( sbn::PMTconfiguration const *  PMTconfig) const
private

Returns a lookup object with board setup and configuration info.

Parameters
PMTconfigthe PMT configuration, if available
Returns
an object working like lookup table for all fragment information

This method merges the setup information from the module configuration with the PMT configuration specified in the argument, and returns an object that can look up all the information as a single record, with the fragment ID as key. In addition, a few intermediate quantities ("facts", see BoardFacts_t) are computed and stored in this object.

If a fragment ID is missing, it means that no PMT configuration was provided and that the setup information did not include a fragment ID. If some information (configuration or setup) is missing, the "facts" depending on the missing information will have default values.

ProtoWaveform_t icarus::DaqDecoderICARUSPMT::mergeWaveformGroup ( std::vector< ProtoWaveform_t > &  allWaveforms,
std::vector< std::size_t > const &  indices 
) const
private

Returns a waveform merging of the indices ones from allWaveforms. The merged waveforms are emptied of their content.

unsigned int icarus::DaqDecoderICARUSPMT::mergeWaveforms ( std::vector< ProtoWaveform_t > &  waveforms) const
private

Merges "in place" waveforms based on timestamp.

Returns
the number of original waveforms merged into another
NeededBoardInfo_t icarus::DaqDecoderICARUSPMT::neededBoardInfo ( artdaq::Fragment::fragment_id_t  fragment_id) const
private

Returns the board information for this fragment.

std::vector<ProtoWaveform_t> icarus::DaqDecoderICARUSPMT::processBoardFragments ( artdaq::FragmentPtrs const &  artdaqFragment,
TriggerInfo_t const &  triggerInfo 
)
private

Extracts waveforms from the specified fragments from a board.

std::vector<ProtoWaveform_t> icarus::DaqDecoderICARUSPMT::processFragment ( artdaq::Fragment const &  artdaqFragment,
NeededBoardInfo_t const &  boardInfo,
TriggerInfo_t const &  triggerInfo 
)
private

Create waveforms and fills trees for the specified artDAQ fragment.

Parameters
artdaqFragmentthe fragment to process
boardInfoboard information needed, from configuration/setup
triggerTimeabsolute time of the trigger
Returns
collection of PMT waveforms from the fragment

This method fills the information for the PMT fragment tree (fillPMTfragmentTree()) and creates PMT waveforms from the fragment data (createFragmentWaveforms()).

void icarus::DaqDecoderICARUSPMT::produce ( art::Event &  event)
override

Processes the event.

artdaq::Fragments const& icarus::DaqDecoderICARUSPMT::readInputFragments ( art::Event const &  event) const
private

Reads the fragments to be processed.

template<std::size_t NBits, typename T >
constexpr std::pair< std::array< std::size_t, NBits >, std::size_t > icarus::DaqDecoderICARUSPMT::setBitIndices ( value)
staticprivatenoexcept

Returns the count of set bits for each set bit.

Template Parameters
NBitsthe number of bits to test
Parameters
valuethe bit mask to be analyzed
Returns
a pair: first an array with the NBits values, second the number of bits set

Much better to go with an example. Let's process setBitIndices<16U>(0x6701): value is 0110 0111 0000 0001, and we request the 16 least significant bits (NBits). There are six bit that are set, in position 0, 8, 9, 10, 13 and 14. The returned value includes the number of set bits (6) as the second element of the pair, an as first an array of 16 indices, one for each bit position. Its values are 0 at [0], 1 at [8], 2 at [9], 3 at [10], 4 at [13] and 5 at [14]. That is, each value represents the number of that bit in the list of set bits. All the other indices, associated to the bits which are not set, are assigned a value that is equal or larger than the number of bits set (i.e. 6 or larger).

Definition at line 1276 of file DaqDecoderICARUSPMT_module.cc.

1276  {
1277 
1278  std::pair<std::array<std::size_t, NBits>, std::size_t> res;
1279  auto& [ indices, nSetBits ] = res;
1280  for (std::size_t& index: indices) {
1281  index = (value & 1)? nSetBits++: NBits;
1282  value >>= 1;
1283  } // for
1284  return res;
1285 
1286 } // icarus::DaqDecoderICARUSPMT::setBitIndices()
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
temporary value
void icarus::DaqDecoderICARUSPMT::sortWaveforms ( std::vector< ProtoWaveform_t > &  waveforms) const
private

Sorts in place the specified waveforms in channel order, then in time.

static long long int icarus::DaqDecoderICARUSPMT::timestampDiff ( std::uint64_t  a,
std::uint64_t  b 
)
inlinestaticprivate

Returns the timestamp difference a - b.

Definition at line 960 of file DaqDecoderICARUSPMT_module.cc.

961  { return static_cast<long long int>(a) - static_cast<long long int>(b); }
process_name gaushit a
std::string const & icarus::DaqDecoderICARUSPMT::treeName ( DataTrees  treeID)
staticprivate

Returns the name of the specified tree.

Definition at line 1308 of file DaqDecoderICARUSPMT_module.cc.

1309  { return TreeNames[static_cast<std::size_t>(treeID)]; }
static TreeNameList_t const TreeNames
bool icarus::DaqDecoderICARUSPMT::UpdatePMTConfiguration ( sbn::PMTconfiguration const *  PMTconfig)
private

Updates the PMT configuration cache. How? Dunno. Placeholder.

void icarus::DaqDecoderICARUSPMT::usesEventInfo ( )
private

Declares the use of event information.

electronics_time icarus::DaqDecoderICARUSPMT::waveformEndTime ( raw::OpDetWaveform const &  wf) const
inlineprivate

Definition at line 1038 of file DaqDecoderICARUSPMT_module.cc.

1039  { return waveformStartTime(wf) + fOpticalTick * wf.size(); }
nanoseconds const fOpticalTick
Duration of the optical detector readout sampling tick (i.e. 2 ns; hush!).
electronics_time waveformStartTime(raw::OpDetWaveform const &wf) const
electronics_time icarus::DaqDecoderICARUSPMT::waveformEndTime ( ProtoWaveform_t const &  wf) const
inlineprivate

Definition at line 1041 of file DaqDecoderICARUSPMT_module.cc.

1042  { return waveformEndTime(wf.waveform); }
electronics_time waveformEndTime(raw::OpDetWaveform const &wf) const
electronics_time icarus::DaqDecoderICARUSPMT::waveformStartTime ( raw::OpDetWaveform const &  wf) const
inlineprivate

Definition at line 1032 of file DaqDecoderICARUSPMT_module.cc.

1033  { return electronics_time{ wf.TimeStamp() }; }
timescale_traits< ElectronicsTimeCategory >::time_point_t electronics_time
A point in time on the electronics time scale.
electronics_time icarus::DaqDecoderICARUSPMT::waveformStartTime ( ProtoWaveform_t const &  wf) const
inlineprivate

Definition at line 1035 of file DaqDecoderICARUSPMT_module.cc.

1036  { return waveformStartTime(wf.waveform); }
electronics_time waveformStartTime(raw::OpDetWaveform const &wf) const

Friends And Related Function Documentation

friend struct dumpChannel
friend

Definition at line 1141 of file DaqDecoderICARUSPMT_module.cc.

std::ostream& operator<< ( std::ostream &  ,
ProtoWaveform_t const &   
)
friend

Member Data Documentation

std::optional<daq::details::BoardInfoLookup> icarus::DaqDecoderICARUSPMT::fBoardInfoLookup
private

Find the information on a readout boards by fragment ID.

Definition at line 786 of file DaqDecoderICARUSPMT_module.cc.

std::vector<daq::details::BoardSetup_t> const icarus::DaqDecoderICARUSPMT::fBoardSetup
private

All board setup settings.

Definition at line 749 of file DaqDecoderICARUSPMT_module.cc.

icarusDB::IICARUSChannelMap const& icarus::DaqDecoderICARUSPMT::fChannelMap
private

Fragment/channel mapping database.

Definition at line 767 of file DaqDecoderICARUSPMT_module.cc.

util::ArtHandleTrackerManager<art::Event> icarus::DaqDecoderICARUSPMT::fDataCacheRemover
mutableprivate

Tracks art data products and removes their cached data on demand.

Definition at line 976 of file DaqDecoderICARUSPMT_module.cc.

detinfo::DetectorTimings const icarus::DaqDecoderICARUSPMT::fDetTimings
private

Interface to LArSoft configuration for detector timing.

Definition at line 764 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fDiagnosticOutput
private

If true will spew endless messages to output.

Definition at line 730 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fDropRawDataAfterUse
private

Clear fragment data product cache after use.

Definition at line 754 of file DaqDecoderICARUSPMT_module.cc.

std::unique_ptr<TreeData_EventID_t> icarus::DaqDecoderICARUSPMT::fEventInfo
private

Event ID for trees.

Tree with fragment information.

Definition at line 907 of file DaqDecoderICARUSPMT_module.cc.

std::vector<art::InputTag> const icarus::DaqDecoderICARUSPMT::fInputTags
private

< List of candidate data products with artDAQ data fragments.

Definition at line 725 of file DaqDecoderICARUSPMT_module.cc.

std::string const icarus::DaqDecoderICARUSPMT::fLogCategory
private

Message facility category.

Definition at line 756 of file DaqDecoderICARUSPMT_module.cc.

unsigned int icarus::DaqDecoderICARUSPMT::fNFailures = 0U
private

Number of event failures encountered.

Definition at line 791 of file DaqDecoderICARUSPMT_module.cc.

electronics_time const icarus::DaqDecoderICARUSPMT::fNominalTriggerTime
private

Trigger time as reported by detinfo::DetectorClocks service.

Definition at line 778 of file DaqDecoderICARUSPMT_module.cc.

nanoseconds const icarus::DaqDecoderICARUSPMT::fOpticalTick
private

Duration of the optical detector readout sampling tick (i.e. 2 ns; hush!).

Definition at line 775 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fPacketDump
private

Dump V1730 data.

Definition at line 732 of file DaqDecoderICARUSPMT_module.cc.

std::optional<art::InputTag> const icarus::DaqDecoderICARUSPMT::fPMTconfigTag
private

Input tag of the PMT configuration.

Definition at line 741 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fRequireBoardConfig
private

Whether setup info on all boards is required.

Definition at line 738 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fRequireKnownBoards
private

Whether info on all input boards is required.

Definition at line 735 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fSkipWaveforms
private

Whether to skip waveform decoding.

Definition at line 751 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fSurviveExceptions
private

Whether to "ignore" errors.

Definition at line 727 of file DaqDecoderICARUSPMT_module.cc.

std::unique_ptr<TreeFragment_t> icarus::DaqDecoderICARUSPMT::fTreeFragment
private

Definition at line 910 of file DaqDecoderICARUSPMT_module.cc.

std::optional<art::InputTag> const icarus::DaqDecoderICARUSPMT::fTriggerTag
private

Input tag of the global trigger.

Definition at line 744 of file DaqDecoderICARUSPMT_module.cc.

bool const icarus::DaqDecoderICARUSPMT::fTTTresetEverySecond
private

Whether V1730 TTT is reset every second.

Definition at line 746 of file DaqDecoderICARUSPMT_module.cc.

constexpr electronics_time icarus::DaqDecoderICARUSPMT::NoTimestamp = std::numeric_limits<electronics_time>::min()
static

Definition at line 636 of file DaqDecoderICARUSPMT_module.cc.

icarus::DaqDecoderICARUSPMT::TreeNameList_t const icarus::DaqDecoderICARUSPMT::TreeNames = icarus::DaqDecoderICARUSPMT::initTreeNames()
staticprivate

Definition at line 417 of file DaqDecoderICARUSPMT_module.cc.


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