PAASS
Software suite to Acquire and Analyze Data from Pixie16
Poll Class Reference

#include <poll2_core.h>

Collaboration diagram for Poll:

Public Member Functions

 Poll ()
 Default constructor. More...
 
 ~Poll ()
 Destructor. More...
 
bool Initialize ()
 Initialize the poll object. More...
 
void SetBootFast (bool input_=true)
 
void SetWallClock (bool input_=true)
 
void SetQuietMode (bool input_=true)
 
void SetSendAlarm (bool input_=true)
 
void SetShowRates (bool input_=true)
 
void SetZeroClocks (bool input_=true)
 
void SetDebugMode (bool input_=true)
 
void SetShmMode (bool input_=true)
 
void SetPacmanMode (bool input_=true)
 
void SetNcards (const size_t &n_cards_)
 
void SetThreshWords (const size_t &thresh_)
 
void SetTerminal (Terminal *term)
 Set the terminal pointer. More...
 
bool GetBootFast ()
 
bool GetWallClock ()
 
bool GetQuietMode ()
 
bool GetSendAlarm ()
 
bool GetShowRates ()
 
bool GetZeroClocks ()
 
bool GetDebugMode ()
 
bool GetShmMode ()
 
bool GetPacmanMode ()
 
size_t GetNcards ()
 
size_t GetThreshWords ()
 
void PrintModuleInfo ()
 Prints the information about each module. More...
 
void CommandControl ()
 Main control loop for handling user input. More...
 
void RunControl ()
 Main acquisition control loop for handling data acq. More...
 
bool Close ()
 Close the sockets, any open files, and clean up. More...
 

Private Types

typedef std::pair< unsigned int, unsigned int > chanid_t
 

Private Member Functions

void help ()
 Data packet for class shared-memory broadcast. More...
 
void pchan_help ()
 Print help dialogue for reading/writing pixie channel parameters. More...
 
void pmod_help ()
 Print help dialogue for reading/writing pixie module parameters. More...
 
bool start_run (const bool &record_=true, const double &time_=-1.0)
 Start a data recording run. More...
 
bool stop_run ()
 Stop an active data recording run. More...
 
void show_status ()
 Display run status information. More...
 
void show_thresh ()
 Display polling threshold. More...
 
void get_traces (int mod_, int chan_, int thresh_=0)
 Acquire raw traces from a pixie module. More...
 
std::vector< std::string > TabComplete (const std::string &value_, const std::vector< std::string > &valid_)
 Method responsible for handling tab complete. More...
 
bool ReadFIFO ()
 Routine to read Pixie FIFOs. More...
 
void ReadScalers ()
 Routine to read Pixie scalers. More...
 
void UpdateStatus ()
 Routine to update the status message. More...
 
bool synch_mods ()
 Set IN_SYNCH and SYNCH_WAIT parameters on all modules. More...
 
std::string get_filename ()
 Return the current output filename. More...
 
bool CloseOutputFile (const bool continueRun=false)
 Close the current output file, if one is open. More...
 
bool OpenOutputFile (bool continueRun=false)
 Opens a new file if no file is currently open. More...
 
int write_data (word_t *data, unsigned int nWords)
 Write a data spill to disk. More...
 
void broadcast_data (word_t *data, unsigned int nWords)
 Broadcast a data spill onto the network. More...
 
void broadcast_pac_data ()
 Broadcast a data spill onto the network in the classic pacman format. More...
 
bool SplitParameterArgs (const std::string &arg, int &start, int &stop)
 Splits the arguments to pread and pwrite on a colon delimeter. More...
 

Private Attributes

Terminalpoll_term_
 
std::vector< word_t > * partialEvents
 A vector to store the partial events. More...
 
double startTime
 
double lastSpillTime
 Time when the acquistion was started. More...
 
struct tm * time_info
 Time when the last spill finished. More...
 
Clientclient
 
Serverserver
 UDP client for network access. More...
 
PixieInterfacepif
 UDP server to listen for pacman commands. More...
 
std::string sys_message_head
 The main pixie interface pointer. More...
 
bool kill_all
 Command line message header. More...
 
bool do_start_acq
 Set to true when the program is exiting. More...
 
bool do_stop_acq
 Set to true when the command is given to start a run. More...
 
bool record_data
 Set to true when the command is given to stop a run. More...
 
bool do_reboot
 Set to true if data is to be recorded to disk. More...
 
bool force_spill
 Set to true when the user tells POLL to reboot PIXIE. More...
 
bool acq_running
 Force poll2 to dump the current data spill. More...
 
bool run_ctrl_exit
 Set to true when run_command is recieving data from PIXIE. More...
 
bool had_error
 Set to true when run_command exits. More...
 
bool file_open
 
time_t raw_time
 
bool do_MCA_run
 
MCA_args mca_args
 Set to true when the "mca" command is received. More...
 
bool boot_fast
 Structure to hold arguments for MCA program. More...
 
bool insert_wall_clock
 
bool is_quiet
 
bool send_alarm
 
bool show_module_rates
 
bool zero_clocks
 
bool debug_mode
 
bool shm_mode
 
bool pac_mode
 New style shared-memory mode. More...
 
bool init
 Pacman shared-memory mode. More...
 
double runTime
 
std::string output_directory
 Time to run the acquisition, in seconds. More...
 
std::string filename_prefix
 Set with 'fdir' command. More...
 
std::string output_title
 Set with 'ouf' command. More...
 
unsigned int next_run_num
 Set with 'htit' command. More...
 
unsigned int output_format
 Set with 'hnum' command. More...
 
int current_file_num
 Set with 'oform' command. More...
 
PollOutputFile output_file
 
unsigned int udp_sequence
 Pacman related variables. More...
 
unsigned int total_spill_chunks
 Total number of poll data spill chunks sent over the network. More...
 
size_t n_cards
 
size_t threshWords
 
std::map< chanid_t, PixieInterface::HistogramhistoMap
 
StatsHandlerstatsHandler
 
std::vector< std::string > commands_
 
data_pack AcqBuf
 

Static Private Attributes

static const int statsInterval_ = 3
 The amount time between scaler reads in seconds. More...
 
static const std::vector< std::string > runControlCommands_
 
static const std::vector< std::string > paramControlCommands_
 
static const std::vector< std::string > pollStatusCommands_
 

Detailed Description

Definition at line 103 of file poll2_core.h.

Member Typedef Documentation

§ chanid_t

typedef std::pair<unsigned int, unsigned int> Poll::chanid_t
private

Definition at line 168 of file poll2_core.h.

Constructor & Destructor Documentation

§ Poll()

Poll::Poll ( )

Default constructor.

Definition at line 168 of file poll2_core.cpp.

Here is the call graph for this function:

§ ~Poll()

Poll::~Poll ( )

Destructor.

Definition at line 223 of file poll2_core.cpp.

Here is the call graph for this function:

Member Function Documentation

§ broadcast_data()

void Poll::broadcast_data ( word_t data,
unsigned int  nWords 
)
private

Broadcast a data spill onto the network.

Definition at line 482 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ broadcast_pac_data()

void Poll::broadcast_pac_data ( )
private

Broadcast a data spill onto the network in the classic pacman format.

Definition at line 570 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ Close()

bool Poll::Close ( )

Close the sockets, any open files, and clean up.

Clean up things that are created during Poll::Initialize().

Returns
Returns true if successful.

Definition at line 311 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ CloseOutputFile()

bool Poll::CloseOutputFile ( const bool  continueRun = false)
private

Close the current output file, if one is open.

Safely close current data file if one is open. The scalers are cleared when this is called.

Parameters
[in]continueRunFlag indicating whether we are continuing the same run, but opening a new continuation file.
Returns
True if the file was closed successfully.

Definition at line 345 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ CommandControl()

void Poll::CommandControl ( )

Main control loop for handling user input.

Here is the caller graph for this function:

§ get_filename()

std::string Poll::get_filename ( )
private

Return the current output filename.

§ get_traces()

void Poll::get_traces ( int  mod_,
int  chan_,
int  thresh_ = 0 
)
private

Acquire raw traces from a pixie module.

Definition at line 776 of file poll2_core.cpp.

§ GetBootFast()

bool Poll::GetBootFast ( )
inline

Definition at line 282 of file poll2_core.h.

§ GetDebugMode()

bool Poll::GetDebugMode ( )
inline

Definition at line 294 of file poll2_core.h.

§ GetNcards()

size_t Poll::GetNcards ( )
inline

Definition at line 300 of file poll2_core.h.

§ GetPacmanMode()

bool Poll::GetPacmanMode ( )
inline

Definition at line 298 of file poll2_core.h.

Here is the caller graph for this function:

§ GetQuietMode()

bool Poll::GetQuietMode ( )
inline

Definition at line 286 of file poll2_core.h.

§ GetSendAlarm()

bool Poll::GetSendAlarm ( )
inline

Definition at line 288 of file poll2_core.h.

Here is the caller graph for this function:

§ GetShmMode()

bool Poll::GetShmMode ( )
inline

Definition at line 296 of file poll2_core.h.

§ GetShowRates()

bool Poll::GetShowRates ( )
inline

Definition at line 290 of file poll2_core.h.

§ GetThreshWords()

size_t Poll::GetThreshWords ( )
inline

Definition at line 302 of file poll2_core.h.

Here is the call graph for this function:
Here is the caller graph for this function:

§ GetWallClock()

bool Poll::GetWallClock ( )
inline

Definition at line 284 of file poll2_core.h.

§ GetZeroClocks()

bool Poll::GetZeroClocks ( )
inline

Definition at line 292 of file poll2_core.h.

§ help()

void Poll::help ( )
private

Data packet for class shared-memory broadcast.

Print help dialogue for POLL options.

Definition at line 628 of file poll2_core.cpp.

Here is the caller graph for this function:

§ Initialize()

bool Poll::Initialize ( )

Initialize the poll object.

Definition at line 246 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ OpenOutputFile()

bool Poll::OpenOutputFile ( bool  continueRun = false)
private

Opens a new file if no file is currently open.

Opens a new file if no file is currently open. The new file is determined from the output directory, run number and prefix. The run number may be iterated forward if a file already exists. If this is a continuation run the run number is not iterated and instead a suffix number is incremented.

The scalers are cleared when this is called if a file is not open already.

Parameters
[in]continueRunFlag indicating that this file should be a continuation run and that the run number should not be iterated.
Returns
True if successfully opened a new file.

Definition at line 391 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ pchan_help()

void Poll::pchan_help ( )
private

Print help dialogue for reading/writing pixie channel parameters.

Definition at line 669 of file poll2_core.cpp.

Here is the caller graph for this function:

§ pmod_help()

void Poll::pmod_help ( )
private

Print help dialogue for reading/writing pixie module parameters.

Definition at line 677 of file poll2_core.cpp.

Here is the caller graph for this function:

§ PrintModuleInfo()

void Poll::PrintModuleInfo ( )

Prints the information about each module.

Definition at line 231 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ ReadFIFO()

bool Poll::ReadFIFO ( )
private

Routine to read Pixie FIFOs.

Here is the caller graph for this function:

§ ReadScalers()

void Poll::ReadScalers ( )
private

Routine to read Pixie scalers.

Here is the caller graph for this function:

§ RunControl()

void Poll::RunControl ( )

Main acquisition control loop for handling data acq.

Here is the caller graph for this function:

§ SetBootFast()

void Poll::SetBootFast ( bool  input_ = true)
inline

Definition at line 256 of file poll2_core.h.

Here is the caller graph for this function:

§ SetDebugMode()

void Poll::SetDebugMode ( bool  input_ = true)
inline

Definition at line 268 of file poll2_core.h.

Here is the caller graph for this function:

§ SetNcards()

void Poll::SetNcards ( const size_t &  n_cards_)
inline

Definition at line 274 of file poll2_core.h.

§ SetPacmanMode()

void Poll::SetPacmanMode ( bool  input_ = true)
inline

Definition at line 272 of file poll2_core.h.

Here is the caller graph for this function:

§ SetQuietMode()

void Poll::SetQuietMode ( bool  input_ = true)
inline

Definition at line 260 of file poll2_core.h.

Here is the caller graph for this function:

§ SetSendAlarm()

void Poll::SetSendAlarm ( bool  input_ = true)
inline

Definition at line 262 of file poll2_core.h.

Here is the caller graph for this function:

§ SetShmMode()

void Poll::SetShmMode ( bool  input_ = true)
inline

Definition at line 270 of file poll2_core.h.

§ SetShowRates()

void Poll::SetShowRates ( bool  input_ = true)
inline

Definition at line 264 of file poll2_core.h.

Here is the caller graph for this function:

§ SetTerminal()

void Poll::SetTerminal ( Terminal term)
inline

Set the terminal pointer.

Definition at line 279 of file poll2_core.h.

Here is the caller graph for this function:

§ SetThreshWords()

void Poll::SetThreshWords ( const size_t &  thresh_)
inline

Definition at line 276 of file poll2_core.h.

Here is the caller graph for this function:

§ SetWallClock()

void Poll::SetWallClock ( bool  input_ = true)
inline

Definition at line 258 of file poll2_core.h.

Here is the caller graph for this function:

§ SetZeroClocks()

void Poll::SetZeroClocks ( bool  input_ = true)
inline

Definition at line 266 of file poll2_core.h.

Here is the caller graph for this function:

§ show_status()

void Poll::show_status ( )
private

Display run status information.

Definition at line 743 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ show_thresh()

void Poll::show_thresh ( )
private

Display polling threshold.

Definition at line 770 of file poll2_core.cpp.

Here is the caller graph for this function:

§ SplitParameterArgs()

bool Poll::SplitParameterArgs ( const std::string &  arg,
int &  start,
int &  stop 
)
private

Splits the arguments to pread and pwrite on a colon delimeter.

Parameters
[in]argThe argument to be split.
[out]startThe first value in the string indicating the first mod / ch.
[out]startThe second value in the string indicating the last mod / ch.
Returns
Whether the attempt was succesful.
Here is the caller graph for this function:

§ start_run()

bool Poll::start_run ( const bool &  record_ = true,
const double &  time_ = -1.0 
)
private

Start a data recording run.

Starts a data recording run. Open data file is closed, the run number is iterated and a new file is opened. If the file was successfully opened the acquisition is started. If a run is already started a warning is displayed and the process is stopped.

Parameters
[in]record_Record a data file.
[in]time_The approximate number of seconds to run the acquisition.
Returns
Returns true if successfully starts a run.

Definition at line 692 of file poll2_core.cpp.

Here is the caller graph for this function:

§ stop_run()

bool Poll::stop_run ( )
private

Stop an active data recording run.

Current run is stopped. This includes disabling data recording. This command stops the acquisition even if data recording is not active.

Returns
Returns true if successful.

Definition at line 721 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ synch_mods()

bool Poll::synch_mods ( )
private

Set IN_SYNCH and SYNCH_WAIT parameters on all modules.

Definition at line 433 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ TabComplete()

std::vector<std::string> Poll::TabComplete ( const std::string &  value_,
const std::vector< std::string > &  valid_ 
)
private

Method responsible for handling tab complete.

§ UpdateStatus()

void Poll::UpdateStatus ( )
private

Routine to update the status message.

Here is the caller graph for this function:

§ write_data()

int Poll::write_data ( word_t data,
unsigned int  nWords 
)
private

Write a data spill to disk.

Definition at line 457 of file poll2_core.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

§ acq_running

bool Poll::acq_running
private

Force poll2 to dump the current data spill.

Definition at line 127 of file poll2_core.h.

§ AcqBuf

data_pack Poll::AcqBuf
private

Definition at line 179 of file poll2_core.h.

§ boot_fast

bool Poll::boot_fast
private

Structure to hold arguments for MCA program.

Definition at line 138 of file poll2_core.h.

§ client

Client* Poll::client
private

Definition at line 114 of file poll2_core.h.

§ commands_

std::vector<std::string> Poll::commands_
private

Definition at line 177 of file poll2_core.h.

§ current_file_num

int Poll::current_file_num
private

Set with 'oform' command.

Definition at line 158 of file poll2_core.h.

§ debug_mode

bool Poll::debug_mode
private

Definition at line 144 of file poll2_core.h.

§ do_MCA_run

bool Poll::do_MCA_run
private

Definition at line 134 of file poll2_core.h.

§ do_reboot

bool Poll::do_reboot
private

Set to true if data is to be recorded to disk.

Definition at line 125 of file poll2_core.h.

§ do_start_acq

bool Poll::do_start_acq
private

Set to true when the program is exiting.

Definition at line 122 of file poll2_core.h.

§ do_stop_acq

bool Poll::do_stop_acq
private

Set to true when the command is given to start a run.

Definition at line 123 of file poll2_core.h.

§ file_open

bool Poll::file_open
private

Definition at line 130 of file poll2_core.h.

§ filename_prefix

std::string Poll::filename_prefix
private

Set with 'fdir' command.

Definition at line 152 of file poll2_core.h.

§ force_spill

bool Poll::force_spill
private

Set to true when the user tells POLL to reboot PIXIE.

Definition at line 126 of file poll2_core.h.

§ had_error

bool Poll::had_error
private

Set to true when run_command exits.

Definition at line 129 of file poll2_core.h.

§ histoMap

std::map<chanid_t, PixieInterface::Histogram> Poll::histoMap
private

Definition at line 169 of file poll2_core.h.

§ init

bool Poll::init
private

Pacman shared-memory mode.

Definition at line 147 of file poll2_core.h.

§ insert_wall_clock

bool Poll::insert_wall_clock
private

Definition at line 139 of file poll2_core.h.

§ is_quiet

bool Poll::is_quiet
private

Definition at line 140 of file poll2_core.h.

§ kill_all

bool Poll::kill_all
private

Command line message header.

Definition at line 121 of file poll2_core.h.

§ lastSpillTime

double Poll::lastSpillTime
private

Time when the acquistion was started.

Definition at line 110 of file poll2_core.h.

§ mca_args

MCA_args Poll::mca_args
private

Set to true when the "mca" command is received.

Definition at line 135 of file poll2_core.h.

§ n_cards

size_t Poll::n_cards
private

Definition at line 165 of file poll2_core.h.

§ next_run_num

unsigned int Poll::next_run_num
private

Set with 'htit' command.

Definition at line 154 of file poll2_core.h.

§ output_directory

std::string Poll::output_directory
private

Time to run the acquisition, in seconds.

Definition at line 151 of file poll2_core.h.

§ output_file

PollOutputFile Poll::output_file
private

Definition at line 159 of file poll2_core.h.

§ output_format

unsigned int Poll::output_format
private

Set with 'hnum' command.

Definition at line 155 of file poll2_core.h.

§ output_title

std::string Poll::output_title
private

Set with 'ouf' command.

Definition at line 153 of file poll2_core.h.

§ pac_mode

bool Poll::pac_mode
private

New style shared-memory mode.

Definition at line 146 of file poll2_core.h.

§ paramControlCommands_

const std::vector< std::string > Poll::paramControlCommands_
staticprivate

Definition at line 175 of file poll2_core.h.

§ partialEvents

std::vector<word_t>* Poll::partialEvents
private

A vector to store the partial events.

Definition at line 107 of file poll2_core.h.

§ pif

PixieInterface* Poll::pif
private

UDP server to listen for pacman commands.

Definition at line 117 of file poll2_core.h.

§ poll_term_

Terminal* Poll::poll_term_
private

Definition at line 105 of file poll2_core.h.

§ pollStatusCommands_

const std::vector< std::string > Poll::pollStatusCommands_
staticprivate

Definition at line 176 of file poll2_core.h.

§ raw_time

time_t Poll::raw_time
private

Definition at line 131 of file poll2_core.h.

§ record_data

bool Poll::record_data
private

Set to true when the command is given to stop a run.

Definition at line 124 of file poll2_core.h.

§ run_ctrl_exit

bool Poll::run_ctrl_exit
private

Set to true when run_command is recieving data from PIXIE.

Definition at line 128 of file poll2_core.h.

§ runControlCommands_

const std::vector< std::string > Poll::runControlCommands_
staticprivate

Definition at line 174 of file poll2_core.h.

§ runTime

double Poll::runTime
private

Definition at line 148 of file poll2_core.h.

§ send_alarm

bool Poll::send_alarm
private

Definition at line 141 of file poll2_core.h.

§ server

Server* Poll::server
private

UDP client for network access.

Definition at line 115 of file poll2_core.h.

§ shm_mode

bool Poll::shm_mode
private

Definition at line 145 of file poll2_core.h.

§ show_module_rates

bool Poll::show_module_rates
private

Definition at line 142 of file poll2_core.h.

§ startTime

double Poll::startTime
private

Definition at line 109 of file poll2_core.h.

§ statsHandler

StatsHandler* Poll::statsHandler
private

Definition at line 171 of file poll2_core.h.

§ statsInterval_

const int Poll::statsInterval_ = 3
staticprivate

The amount time between scaler reads in seconds.

Definition at line 172 of file poll2_core.h.

§ sys_message_head

std::string Poll::sys_message_head
private

The main pixie interface pointer.

Definition at line 120 of file poll2_core.h.

§ threshWords

size_t Poll::threshWords
private

Definition at line 166 of file poll2_core.h.

§ time_info

struct tm* Poll::time_info
private

Time when the last spill finished.

Definition at line 112 of file poll2_core.h.

§ total_spill_chunks

unsigned int Poll::total_spill_chunks
private

Total number of poll data spill chunks sent over the network.

Definition at line 163 of file poll2_core.h.

§ udp_sequence

unsigned int Poll::udp_sequence
private

Pacman related variables.

The number of UDP packets transmitted.

Definition at line 162 of file poll2_core.h.

§ zero_clocks

bool Poll::zero_clocks
private

Definition at line 143 of file poll2_core.h.


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