Skip to content

Commit

Permalink
Merge branch 'develop' into eflumerf/FormatAndWhitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
eflumerf authored Feb 17, 2025
2 parents 95bdb2f + 482e37c commit 21b0276
Show file tree
Hide file tree
Showing 216 changed files with 3,673 additions and 4,580 deletions.
8 changes: 4 additions & 4 deletions artdaq-ots/ArtModules/JSONDispatcher_module.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
////////////////////////////////////////////////////////////////////////
// Class: UDPDump
// Module Type: analyzer
// File: UDPDump_module.cc
// Description: Prints out information about each event.
/// Class: UDPDump
/// Module Type: analyzer
/// File: UDPDump_module.cc
/// Description: Prints out information about each event.
////////////////////////////////////////////////////////////////////////

#include "art/Framework/Core/EDAnalyzer.h"
Expand Down
8 changes: 4 additions & 4 deletions artdaq-ots/ArtModules/UDPDump_module.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
////////////////////////////////////////////////////////////////////////
// Class: UDPDump
// Module Type: analyzer
// File: UDPDump_module.cc
// Description: Prints out information about each event.
/// Class: UDPDump
/// Module Type: analyzer
/// File: UDPDump_module.cc
/// Description: Prints out information about each event.
////////////////////////////////////////////////////////////////////////

#include "art/Framework/Core/EDAnalyzer.h"
Expand Down
46 changes: 23 additions & 23 deletions artdaq-ots/Generators/UDPReceiver.hh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#ifndef artdaq_ots_Generators_UDPReceiver_hh
#define artdaq_ots_Generators_UDPReceiver_hh

// The UDP Receiver class receives UDP data from an otsdaq application and
// puts that data into UDPFragments for further ARTDAQ analysis.
//
// It currently assumes two things to be true:
// 1. The first word of the UDP packet is an 8-bit flag with information
// about the status of the sender
// 2. The second word is an 8-bit sequence ID, used for detecting
// dropped UDP datagrams

// Some C++ conventions used:

// -Append a "_" to every private member function and variable

/// The UDP Receiver class receives UDP data from an otsdaq application and
/// puts that data into UDPFragments for further ARTDAQ analysis.
///
/// It currently assumes two things to be true:
/// 1. The first word of the UDP packet is an 8-bit flag with information
/// about the status of the sender
/// 2. The second word is an 8-bit sequence ID, used for detecting
/// dropped UDP datagrams
///
/// Some C++ conventions used:
///
/// -Append a "_" to every private member function and variable
///
#include "artdaq-core/Data/Fragment.hh"
#include "artdaq/Generators/CommandableFragmentGenerator.hh"
#include "fhiclcpp/fwd.h"
Expand Down Expand Up @@ -75,10 +75,10 @@ class UDPReceiver : public artdaq::CommandableFragmentGenerator
virtual ~UDPReceiver();

protected:
// The "getNext_" function is used to implement user-specific
// functionality; it's a mandatory override of the pure virtual
// getNext_ function declared in CommandableFragmentGenerator

/// The "getNext_" function is used to implement user-specific
/// functionality; it's a mandatory override of the pure virtual
/// getNext_ function declared in CommandableFragmentGenerator
///
bool getNext_(artdaq::FragmentPtrs& output) override;
void start(void) override;
virtual void start_();
Expand All @@ -99,17 +99,17 @@ class UDPReceiver : public artdaq::CommandableFragmentGenerator
bool rawOutput_;
std::string rawPath_;

// FHiCL-configurable variables. Note that the C++ variable names
// are the FHiCL variable names with a "_" appended

/// FHiCL-configurable variables. Note that the C++ variable names
/// are the FHiCL variable names with a "_" appended
///
int dataport_;
std::string ip_;
int rcvbuf_;

// The packet number of the next packet. Used to discover dropped packets
/// The packet number of the next packet. Used to discover dropped packets
uint8_t expectedPacketNumber_;

// Socket parameters
/// Socket parameters
struct sockaddr_in si_data_;
int datasocket_;
bool sendCommands_;
Expand All @@ -124,7 +124,7 @@ class UDPReceiver : public artdaq::CommandableFragmentGenerator

bool fakeDataMode_;

// Number of milliseconds per fragment
/// Number of milliseconds per fragment
double fragmentWindow_;
std::chrono::high_resolution_clock::time_point lastFrag_;
};
Expand Down
2 changes: 1 addition & 1 deletion artdaq-ots/Generators/UDPReceiver_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,5 +392,5 @@ void ots::UDPReceiver::start_()
// #pragma message "Using default implementation of UDPReceiver::start_()"
}

// The following macro is defined in artdaq's GeneratorMacros.hh header
/// The following macro is defined in artdaq's GeneratorMacros.hh header
DEFINE_ARTDAQ_COMMANDABLE_GENERATOR(ots::UDPReceiver)
2 changes: 1 addition & 1 deletion artdaq-ots/Overlays/FragmentType.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum FragmentType : artdaq::Fragment::type_t
INVALID // Should always be last.
};

// Safety check.
/// Safety check.
static_assert(artdaq::Fragment::isUserFragmentType(FragmentType::INVALID - 1),
"Too many user-defined fragments!");
} // namespace detail
Expand Down
88 changes: 44 additions & 44 deletions artdaq-ots/Overlays/UDPFragment.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
#include <ostream>
#include <vector>

// Implementation of "UDPFragment", an artdaq::Fragment overlay class

/// Implementation of "UDPFragment", an artdaq::Fragment overlay class
///
namespace ots
{
class UDPFragment;

// Let the "<<" operator dump the UDPFragment's data to stdout
/// Let the "<<" operator dump the UDPFragment's data to stdout
std::ostream& operator<<(std::ostream&, UDPFragment const&);
} // namespace ots

class ots::UDPFragment
{
public:
// The "Metadata" struct is used to store info primarily related to
// the upstream hardware environment from where the fragment came

// "data_t" is a typedef of the fundamental unit of data the
// metadata structure thinks of itself as consisting of; it can give
// its size via the static "size_words" variable (
// UDPFragment::Metadata::size_words )

/// The "Metadata" struct is used to store info primarily related to
/// the upstream hardware environment from where the fragment came
///
/// "data_t" is a typedef of the fundamental unit of data the
/// metadata structure thinks of itself as consisting of; it can give
/// its size via the static "size_words" variable (
/// UDPFragment::Metadata::size_words )
///
struct Metadata
{
typedef uint64_t data_t;
Expand All @@ -36,27 +36,27 @@ class ots::UDPFragment
data_t address : 32;
data_t unused : 16;

static size_t const size_words = 1ull; // Units of Metadata::data_t
static size_t const size_words = 1ull; ///< Units of Metadata::data_t
};

static_assert(sizeof(Metadata) == Metadata::size_words * sizeof(Metadata::data_t),
"UDPFragment::Metadata size changed");

// The "Header" struct contains "metadata" specific to the fragment
// which is not hardware-related

// Header::data_t -- not to be confused with Metadata::data_t ! --
// describes the standard size of a data type not just for the
// header data, but ALSO the physics data beyond it; the size of the
// header in units of Header::data_t is given by "size_words", and
// the size of the fragment beyond the header in units of
// Header::data_t is given by "event_size"

// Notice only the first 28 bits of the first 32-bit unsigned
// integer in the Header is used to hold the event_size ; this means
// that you can't represent a fragment larger than 2**28 units of
// data_t, or 1,073,741,824 bytes

/// The "Header" struct contains "metadata" specific to the fragment
/// which is not hardware-related
///
/// Header::data_t -- not to be confused with Metadata::data_t ! --
/// describes the standard size of a data type not just for the
/// header data, but ALSO the physics data beyond it; the size of the
/// header in units of Header::data_t is given by "size_words", and
/// the size of the fragment beyond the header in units of
/// Header::data_t is given by "event_size"
///
/// Notice only the first 28 bits of the first 32-bit unsigned
/// integer in the Header is used to hold the event_size ; this means
/// that you can't represent a fragment larger than 2**28 units of
/// data_t, or 1,073,741,824 bytes
///
struct Header
{
typedef uint32_t data_t;
Expand All @@ -67,52 +67,52 @@ class ots::UDPFragment
event_size_t event_size : 28;
event_size_t type : 4;

static size_t const size_words = 1ul; // Units of Header::data_t
static size_t const size_words = 1ul; ///< Units of Header::data_t
};

static_assert(sizeof(Header) == Header::size_words * sizeof(Header::data_t),
"UDPFragment::Header size changed");

// The constructor simply sets its const private member "artdaq_Fragment_"
// to refer to the artdaq::Fragment object

/// The constructor simply sets its const private member "artdaq_Fragment_"
/// to refer to the artdaq::Fragment object
///
UDPFragment(artdaq::Fragment const& f) : artdaq_Fragment_(f) {}

// const getter functions for the data in the header

/// const getter functions for the data in the header
///
Header::event_size_t hdr_event_size() const { return header_()->event_size; }
Header::data_type_t hdr_data_type() const { return header_()->type; }
static constexpr size_t hdr_size_words() { return Header::size_words; }

// UDP Data Word Count
/// UDP Data Word Count
size_t udp_data_words() const
{
return (hdr_event_size() - hdr_size_words()) * bytes_per_word_();
}

// Start of the UDP data, returned as a pointer
/// Start of the UDP data, returned as a pointer
uint8_t const* dataBegin() const
{
return reinterpret_cast<uint8_t const*>(header_() + 1);
}

// End of the UDP data, returned as a pointer
/// End of the UDP data, returned as a pointer
uint8_t const* dataEnd() const { return dataBegin() + udp_data_words(); }

protected:
// Functions to translate between byte size and the size of
// this fragment overlay's concept of a unit of data (i.e.,
// Header::data_t).

/// Functions to translate between byte size and the size of
/// this fragment overlay's concept of a unit of data (i.e.,
/// Header::data_t).
///
static constexpr size_t bytes_per_word_()
{
return sizeof(Header::data_t) / sizeof(uint8_t);
}

// header_() simply takes the address of the start of this overlay's
// data (i.e., where the UDPFragment::Header object begins) and
// casts it as a pointer to UDPFragment::Header

/// header_() simply takes the address of the start of this overlay's
/// data (i.e., where the UDPFragment::Header object begins) and
/// casts it as a pointer to UDPFragment::Header
///
Header const* header_() const
{
return reinterpret_cast<UDPFragment::Header const*>(
Expand Down
46 changes: 23 additions & 23 deletions artdaq-ots/Overlays/UDPFragmentWriter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
#define artdaq_ots_Overlays_UDPFragmentWriter_hh

////////////////////////////////////////////////////////////////////////
// UDPFragmentWriter
//
// Class derived from UDPFragment which allows writes to the data (for
// simulation purposes). Note that for this reason it contains
// non-const members which hide the const members in its parent class,
// UDPFragment, including its reference to the artdaq::Fragment
// object, artdaq_Fragment_, as well as its functions pointing to the
// beginning and end of ADC values in the fragment, dataBegin() and
// dataEnd()
//
/// UDPFragmentWriter
///
/// Class derived from UDPFragment which allows writes to the data (for
/// simulation purposes). Note that for this reason it contains
/// non-const members which hide the const members in its parent class,
/// UDPFragment, including its reference to the artdaq::Fragment
/// object, artdaq_Fragment_, as well as its functions pointing to the
/// beginning and end of ADC values in the fragment, dataBegin() and
/// dataEnd()
///
////////////////////////////////////////////////////////////////////////

#include "artdaq-core/Data/Fragment.hh"
Expand All @@ -29,15 +29,15 @@ class ots::UDPFragmentWriter : public ots::UDPFragment
public:
UDPFragmentWriter(artdaq::Fragment& f);

// These functions form overload sets with const functions from
// ots::UDPFragment

/// These functions form overload sets with const functions from
/// ots::UDPFragment
///
uint8_t* dataBegin();
uint8_t* dataEnd();

// We'll need to hide the const version of header in UDPFragment in
// order to be able to perform writes

/// We'll need to hide the const version of header in UDPFragment in
/// order to be able to perform writes
///
Header* header_()
{
assert(artdaq_Fragment_.dataSizeBytes() >= sizeof(Header));
Expand All @@ -53,14 +53,14 @@ class ots::UDPFragmentWriter : public ots::UDPFragment

static size_t bytes_to_words_(size_t nBytes);

// Note that this non-const reference hides the const reference in the base class
/// Note that this non-const reference hides the const reference in the base class
artdaq::Fragment& artdaq_Fragment_;
};

// The constructor will expect the artdaq::Fragment object it's been
// passed to contain the artdaq::Fragment header + the
// UDPFragment::Metadata object, otherwise it throws

/// The constructor will expect the artdaq::Fragment object it's been
/// passed to contain the artdaq::Fragment header + the
/// UDPFragment::Metadata object, otherwise it throws
///
ots::UDPFragmentWriter::UDPFragmentWriter(artdaq::Fragment& f)
: UDPFragment(f), artdaq_Fragment_(f)
{
Expand All @@ -71,13 +71,13 @@ ots::UDPFragmentWriter::UDPFragmentWriter(artdaq::Fragment& f)
"consist of (and only of) its own header + the UDPFragment::Metadata object");
}

// Allocate space for the header
/// Allocate space for the header
artdaq_Fragment_.resizeBytes(sizeof(Header));
}

inline uint8_t* ots::UDPFragmentWriter::dataBegin()
{
// Make sure there's data past the UDPFragment header
/// Make sure there's data past the UDPFragment header
assert(artdaq_Fragment_.dataSizeBytes() >=
sizeof(Header) + sizeof(artdaq::Fragment::value_type));
return reinterpret_cast<uint8_t*>(header_() + 1);
Expand Down
4 changes: 2 additions & 2 deletions otsdaq/ARTDAQDataManager/ARTDAQDataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace ots
{
class ConfigurationManager;

// ARTDAQDataManager
// This class provides the otsdaq interface to a single artdaq Board Reader.
/// ARTDAQDataManager
/// This class provides the otsdaq interface to a single artdaq Board Reader.
class ARTDAQDataManager : public DataManager
{
public:
Expand Down
8 changes: 4 additions & 4 deletions otsdaq/ARTDAQReaderCore/ARTDAQReaderProcessorBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ ARTDAQReaderProcessorBase::ARTDAQReaderProcessorBase(
} // end constructor()

//==============================================================================
// ARTDAQReaderProcessorBase::ARTDAQReaderProcessorBase(std::string interfaceID, MPI_Comm
// local_group_comm, std::string name) :FEVInterface (feId, 0)
// ,local_group_comm_(local_group_comm)
//,name_ (name)
/// ARTDAQReaderProcessorBase::ARTDAQReaderProcessorBase(std::string interfaceID, MPI_Comm
/// local_group_comm, std::string name) :FEVInterface (feId, 0)
/// ,local_group_comm_(local_group_comm)
///,name_ (name)
//{}

//==============================================================================
Expand Down
Loading

0 comments on commit 21b0276

Please sign in to comment.