artdaq  v2_03_02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
artdaq::Config Class Reference

Helper class for configuring the builder test. More...

#include <proto/Config.hh>

Public Types

enum  TaskType : int { TaskSink = 0, TaskSource = 1, TaskDetector = 2 }
 Type of the builder instance. More...
 

Public Member Functions

 Config (int rank, int nprocs, int buffer_count, size_t max_payload_size, int argc, char *argv[])
 Config Constructor. More...
 
int destCount () const
 Get the number of destinations for this process. More...
 
int destStart () const
 Get the rank of the first destination for this process. More...
 
int srcCount () const
 Get the number of sources for this process. More...
 
int srcStart () const
 Get the rank of the first source for this process. More...
 
int getDestFriend () const
 Get the corresponding destination for this source. More...
 
int getSrcFriend () const
 Get the corresponding source for this destination. More...
 
int getArtArgc (int argc, char *argv[]) const
 Gets the count of arguments after a – delimiter. More...
 
char ** getArtArgv (int argc, char *argv[]) const
 Get the array of arguments after a – delimiter. More...
 
std::string typeName () const
 Get the name of the type of this process. More...
 
void writeInfo () const
 Write information about this Config class to a file.
 
void print (std::ostream &ost) const
 Dump configuration information (space delimited) to a stream. More...
 
void printHeader (std::ostream &ost) const
 Write configuration parameter names to a stream. More...
 
fhicl::ParameterSet makeParameterSet () const
 Write a ParameterSet using configuration. More...
 
fhicl::ParameterSet getArtPset ()
 Get the ParameterSet to use to configure art. More...
 

Static Public Member Functions

static void throwUsage (char *argv0, const std::string &msg)
 Write the usage to cerr and throw an exception. More...
 
static double getArgDetectors (int argc, char *argv[])
 Get the detectors count from the command line. More...
 
static double getArgSinks (int argc, char *argv[])
 Get the sink count from the command line. More...
 
static int getArgQueueSize (int argc, char *argv[])
 Get the Queue Size from the command line. More...
 
static int getArgRun (int argc, char *argv[])
 Get the Run number from the command line. More...
 
static std::string getProcessorName ()
 Call MPI_Get_processor_name. More...
 

Public Attributes

int rank_
 Rank of this application.
 
int total_procs_
 Total number of processes.
 
int detectors_
 Count of detectors.
 
int sources_
 Count of source.
 
int sinks_
 Count of sinks.
 
int detector_start_
 Rank of first detector.
 
int source_start_
 Rank of first source.
 
int sink_start_
 Rank of first sink.
 
int event_queue_size_
 Size of the Event Queue.
 
int run_
 Run Number.
 
int buffer_count_
 Maximum number of simulatneous Fragments.
 
size_t max_payload_size_
 Maximum size of Fragments to create/transfer.
 
TaskType type_
 Type of this Builder application.
 
int offset_
 Offset from the start rank for this type.
 
std::string node_name_
 Name of this node, from MPI_Get_processor_name.
 
int art_argc_
 Count of arguments used for art.
 
char ** art_argv_
 Arguments used for art.
 
bool use_artapp_
 Whether to use art.
 

Static Public Attributes

static const char * usage = "DetectorsPerNode SinksPerNode Run"
 String for command-line arguments.
 

Detailed Description

Helper class for configuring the builder test.

Definition at line 21 of file Config.hh.

Member Enumeration Documentation

Type of the builder instance.

Enumerator
TaskSink 

This Builder is a "Sink".

TaskSource 

This Builder is a "Source".

TaskDetector 

This Builder is a "Detector".

Definition at line 32 of file Config.hh.

Constructor & Destructor Documentation

artdaq::Config::Config ( int  rank,
int  nprocs,
int  buffer_count,
size_t  max_payload_size,
int  argc,
char *  argv[] 
)

Config Constructor.

Parameters
rankRank of this process
nprocsTotal number of processes in the test
buffer_countNumber of Fragments that may be in-flight simultaneously
max_payload_sizeMaximum size of the Fragments
argcNumber of arguments
argvArray of arguments, as strings

Definition at line 26 of file Config.cc.

Member Function Documentation

int artdaq::Config::destCount ( ) const

Get the number of destinations for this process.

Returns
The number of destinations for this process

Definition at line 63 of file Config.cc.

int artdaq::Config::destStart ( ) const

Get the rank of the first destination for this process.

Returns
The rank of the first destination for this process

Definition at line 69 of file Config.cc.

static double artdaq::Config::getArgDetectors ( int  argc,
char *  argv[] 
)
inlinestatic

Get the detectors count from the command line.

Parameters
argcArgument count
argvArray of arguments as strings
Returns
Detector count

Definition at line 187 of file Config.hh.

static int artdaq::Config::getArgQueueSize ( int  argc,
char *  argv[] 
)
inlinestatic

Get the Queue Size from the command line.

Parameters
argcArgument count
argvArray of arguments as strings
Returns
Queue size

Definition at line 211 of file Config.hh.

static int artdaq::Config::getArgRun ( int  argc,
char *  argv[] 
)
inlinestatic

Get the Run number from the command line.

Parameters
argcArgument count
argvArray of arguments as strings
Returns
Run number

Definition at line 223 of file Config.hh.

static double artdaq::Config::getArgSinks ( int  argc,
char *  argv[] 
)
inlinestatic

Get the sink count from the command line.

Parameters
argcArgument count
argvArray of arguments as strings
Returns
Sink count

Definition at line 199 of file Config.hh.

int artdaq::Config::getArtArgc ( int  argc,
char *  argv[] 
) const

Gets the count of arguments after a – delimiter.

Parameters
argcOriginal argc
argvOriginal argv
Returns
argc of arguments after –

Definition at line 103 of file Config.cc.

char ** artdaq::Config::getArtArgv ( int  argc,
char *  argv[] 
) const

Get the array of arguments after a – delimiter.

Parameters
argcOriginal argc
argvOriginal argv
Returns
argv of arguments after –

Definition at line 114 of file Config.cc.

fhicl::ParameterSet artdaq::Config::getArtPset ( )

Get the ParameterSet to use to configure art.

Returns
The ParameterSet used to configure art
* The ParameterSet is read for the following Parameters:
* "daq" (REQUIRED): DAQ config FHiCL table
*   "buffer_count" (Default: buffer_count): Maximum number of simulatneous Fragments
*   "max_fragment_size_words" (Default: max_payload_size): Maximum size of Fragments to create/transfer
* 

Definition at line 181 of file Config.cc.

int artdaq::Config::getDestFriend ( ) const

Get the corresponding destination for this source.

Returns
The corresponding destiantion for this source

Definition at line 93 of file Config.cc.

static std::string artdaq::Config::getProcessorName ( )
inlinestatic

Call MPI_Get_processor_name.

Returns
The result of MPI_Get_processor_name

Definition at line 233 of file Config.hh.

int artdaq::Config::getSrcFriend ( ) const

Get the corresponding source for this destination.

Returns
The corresponding source for this destination

Definition at line 98 of file Config.cc.

fhicl::ParameterSet artdaq::Config::makeParameterSet ( ) const

Write a ParameterSet using configuration.

Returns
A ParameterSet with sources and destinations blocks, as appropriate for the Task

Definition at line 148 of file Config.cc.

void artdaq::Config::print ( std::ostream &  ost) const

Dump configuration information (space delimited) to a stream.

Parameters
ostStream to dump configuration to

Definition at line 132 of file Config.cc.

void artdaq::Config::printHeader ( std::ostream &  ost) const

Write configuration parameter names to a stream.

Parameters
ostStream to write configuration parameter names to

Definition at line 119 of file Config.cc.

int artdaq::Config::srcCount ( ) const

Get the number of sources for this process.

Returns
The number of sources for this process

Definition at line 75 of file Config.cc.

int artdaq::Config::srcStart ( ) const

Get the rank of the first source for this process.

Returns
The rank of the first source for this process

Definition at line 81 of file Config.cc.

static void artdaq::Config::throwUsage ( char *  argv0,
const std::string &  msg 
)
inlinestatic

Write the usage to cerr and throw an exception.

Parameters
argv0First parameter in argv
msgException message

Definition at line 175 of file Config.hh.

std::string artdaq::Config::typeName ( ) const

Get the name of the type of this process.

Returns
The name of the type of this process (one of "Sink", "Source" or "Detector")

Definition at line 87 of file Config.cc.


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