PAASS
Software suite to Acquire and Analyze Data from Pixie16
|
#include <ScanInterface.hpp>
Public Member Functions | |
ScanInterface (Unpacker *core_=NULL) | |
Default constructor. More... | |
virtual | ~ScanInterface () |
Default destructor. More... | |
bool | IsInit () |
Return true if the ScanInterface object has been initialized. More... | |
bool | IsVerbose () |
Return true if verbose output mode is enabled. More... | |
bool | DebugMode () |
Return true if debug mode is enabled. More... | |
bool | DryRunMode () |
Return true if dry run mode is enabled. More... | |
bool | ShmMode () |
Return true if shared memory mode is enabled. More... | |
bool | BatchMode () |
Return true if batch processing mode is enabled. More... | |
std::string | GetMessageHeader () |
Return the header string used to prefix output messages. More... | |
std::string | GetProgramName () |
Return the name of the program. More... | |
std::string | GetSetupFilename () |
std::string | GetOutputFilename () |
fileInformation * | GetFileInfo () |
Return a pointer to a fileInformation object used to store file header info. More... | |
void | SetProgramName (const std::string &head_) |
Set the header string used to prefix output messages. More... | |
bool | SetVerboseMode (bool state_=true) |
Enable or disable verbose output mode. More... | |
bool | SetDebugMode (bool state_=true) |
Enable or disable debug mode. More... | |
bool | SetDryRunMode (bool state_=true) |
Enable or disable dry run mode. More... | |
bool | SetShmMode (bool state_=true) |
Enable or disable shared memory mode. More... | |
bool | SetBatchMode (bool state_=true) |
Enable or disable batch processing mode. More... | |
void | RunControl () |
Main scan control method. More... | |
void | CmdControl () |
Main command interpreter method. More... | |
bool | Setup (int argc, char *argv[]) |
Setup user options and initialize all required objects. More... | |
int | Execute () |
Run the program. More... | |
bool | Close () |
Shutdown cleanly. More... | |
virtual bool | AddEvent (XiaData *event_) |
virtual bool | ProcessEvents () |
Protected Member Functions | |
void | AddOption (optionExt opt_) |
Pointer to class derived from Unpacker class. More... | |
virtual bool | ExtraCommands (const std::string &cmd_, std::vector< std::string > &args_) |
virtual void | ExtraArguments () |
virtual void | CmdHelp (const std::string &prefix_="") |
virtual void | ArgHelp () |
virtual void | SyntaxStr (char *name_) |
virtual void | IdleTask () |
virtual bool | Initialize (std::string prefix_="") |
virtual void | FinalInitialization () |
virtual bool | InitRootOutput (std::string fname_, bool overwrite_=true) |
virtual void | Notify (const std::string &code_="") |
virtual Unpacker * | GetCore () |
Protected Attributes | |
std::string | msgHeader |
std::string | progName |
The string to print before program output. More... | |
std::vector< option > | longOpts |
The name of the program. More... | |
std::vector< optionExt > | baseOpts |
Vector of all command line options. More... | |
std::vector< optionExt > | userOpts |
Base level command line options for the scan. More... | |
std::string | optstr |
User added command line options. More... | |
Unpacker * | core |
Private Member Functions | |
void | start_scan () |
ncurses terminal used for displaying output and handling user input. More... | |
void | stop_scan () |
Stop the scan. More... | |
void | help (char *name_) |
Print a command line argument help dialogue. More... | |
bool | rewind (const unsigned long &offset_=0) |
Seek to a specified position in the file. More... | |
bool | open_input_file (const std::string &fname_) |
Open a new binary input file for reading. More... | |
Private Attributes | |
unsigned int | maxShmSizeL |
unsigned int | maxShmSize |
Max size of shared memory buffer in pixie words (4050 + 2 header words) More... | |
std::string | prefix |
Max size of shared memory buffer in bytes. More... | |
std::string | extension |
Input filename prefix (without extension). More... | |
std::string | workDir |
Input file extension. More... | |
std::string | homeDir |
Linux system current working directory. More... | |
std::string | setup_filename |
Linux user home directory. More... | |
std::string | output_filename |
Name of file to be used for output. More... | |
int | max_spill_size |
int | file_format |
Maximum size of a spill to read. More... | |
unsigned long | num_spills_recvd |
Input file format to use (0=.ldf, 1=.pld, 2=.root). More... | |
unsigned long | file_start_offset |
The total number of good spills received from either the input file or shared memory. More... | |
bool | write_counts |
The first word in the file at which to start scanning. More... | |
bool | total_stopped |
Set to true if raw channel counts are to be written to file. More... | |
bool | is_running |
Set to true if when the scan finishes. More... | |
bool | is_verbose |
Set to true if the acqusition is running. More... | |
bool | debug_mode |
Set to true if the user wishes verbose information to be displayed. More... | |
bool | dry_run_mode |
Set to true if the user wishes to display debug information. More... | |
bool | shm_mode |
Set to true if a dry run is to be performed i.e. data is to be read but not processed. More... | |
bool | batch_mode |
Set to true if shared memory mode is to be used. More... | |
bool | scan_init |
Set to true if the program is to be run with no interactive command line. More... | |
bool | file_open |
Set to true when ScanInterface is initialized properly and is ready to scan. More... | |
bool | kill_all |
Set to true when an input binary file is successfully opened for reading. More... | |
bool | run_ctrl_exit |
Set to true when user has sent kill command. More... | |
Server * | poll_server |
Set to true when run control thread has exited. More... | |
std::ifstream | input_file |
Poll2 shared memory server. More... | |
std::streampos | file_length |
Main input binary data file. More... | |
fileInformation | finfo |
Main input file length (in bytes). More... | |
PLD_header | pldHead |
Data structure for storing binary file header information. More... | |
PLD_data | pldData |
PLD style HEAD buffer handler. More... | |
DIR_buffer | dirbuff |
PLD style DATA buffer handler. More... | |
HEAD_buffer | headbuff |
HRIBF DIR buffer handler. More... | |
DATA_buffer | databuff |
HRIBF HEAD buffer handler. More... | |
EOF_buffer | eofbuff |
HRIBF DATA buffer handler. More... | |
Terminal * | term |
HRIBF EOF buffer handler. More... | |
Definition at line 79 of file ScanInterface.hpp.
ScanInterface::ScanInterface | ( | Unpacker * | core_ = NULL | ) |
Default constructor.
Default constructor.
[in] | core_ | Pointer to an object derived from Unpacker. |
Definition at line 359 of file ScanInterface.cpp.
|
virtual |
Default destructor.
Definition at line 432 of file ScanInterface.cpp.
|
inlinevirtual |
Add a channel event to the deque of events to send to the processors. This method should only be called from Unpacker::ProcessRawEvent().
[in] | event_ | The raw XiaData to add. Unused by default. |
Reimplemented in scopeScanner, and skeletonScanner.
Definition at line 161 of file ScanInterface.hpp.
|
protected |
Pointer to class derived from Unpacker class.
Add a command line option to the option list.
[in] | opt_ | The option to add to the list. |
Definition at line 312 of file ScanInterface.cpp.
|
inlineprotectedvirtual |
ArgHelp is used to allow a derived class to add a command line option to the main list of options. This method is called at the end of from the ::Setup method. Does nothing useful by default.
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 219 of file ScanInterface.hpp.
|
inline |
Return true if batch processing mode is enabled.
Definition at line 103 of file ScanInterface.hpp.
bool ScanInterface::Close | ( | ) |
Shutdown cleanly.
Shutdown cleanly. Uninitialize the ScanInterface object.
Definition at line 1081 of file ScanInterface.cpp.
void ScanInterface::CmdControl | ( | ) |
Main command interpreter method.
Definition at line 706 of file ScanInterface.cpp.
|
inlineprotectedvirtual |
CmdHelp is used to allow a derived class to print a help statement about its own commands. This method is called whenever the user enters 'help' or 'h' into the interactive terminal (if available). Does nothing useful by default.
[in] | prefix_ | String to append at the start of any output. Not used by default. |
Reimplemented in scopeScanner, and skeletonScanner.
Definition at line 211 of file ScanInterface.hpp.
|
inline |
Return true if debug mode is enabled.
Definition at line 94 of file ScanInterface.hpp.
|
inline |
Return true if dry run mode is enabled.
Definition at line 97 of file ScanInterface.hpp.
int ScanInterface::Execute | ( | ) |
Run the program.
Run the scan program. This should be called from main().
Definition at line 1048 of file ScanInterface.cpp.
|
inlineprotectedvirtual |
ExtraArguments is used to send command line arguments to classes derived from ScanInterface. This method should loop over the optionExt elements in the vector userOpts and check for those options which have been flagged as active by ::Setup(). This should be overloaded in the derived class.
Reimplemented in scopeScanner, and skeletonScanner.
Definition at line 202 of file ScanInterface.hpp.
|
inlineprotectedvirtual |
ExtraCommands is used to send command strings to classes derived from ScanInterface. If ScanInterface receives an unrecognized command from the user, it will pass it on to the derived class. Does nothing useful by default.
[in] | cmd_ | The command to interpret. Not used by default. |
[out] | arg_ | Vector or arguments to the user command. Not used by default. |
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 194 of file ScanInterface.hpp.
|
inlineprotectedvirtual |
Peform any last minute initialization which derived classes need to run before processing data. Does nothing useful by default. /return Nothing.
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 249 of file ScanInterface.hpp.
|
protectedvirtual |
Return a pointer to the Unpacker object to use for data unpacking. If no object has been initialized, create a new one.
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 351 of file ScanInterface.cpp.
|
inline |
Return a pointer to a fileInformation object used to store file header info.
Definition at line 118 of file ScanInterface.hpp.
|
inline |
Return the header string used to prefix output messages.
Definition at line 106 of file ScanInterface.hpp.
|
inline |
Definition at line 115 of file ScanInterface.hpp.
|
inline |
Return the name of the program.
Definition at line 109 of file ScanInterface.hpp.
|
inline |
Definition at line 112 of file ScanInterface.hpp.
|
private |
Print a command line argument help dialogue.
Print a command line argument help dialogue.
[in] | name_ | The name of the program. |
Definition at line 163 of file ScanInterface.cpp.
|
inlineprotectedvirtual |
IdleTask is called whenever a scan is running in shared memory mode, and a spill has yet to be received. This method may be used to update things which need to be updated every so often (e.g. a root TCanvas) when working with a low data rate. Does nothing useful by default.
Reimplemented in skeletonScanner, UtkScanInterface, and RootScanner.
Definition at line 235 of file ScanInterface.hpp.
|
protectedvirtual |
Initialize the Unpacker object. Does nothing useful by default.
[in] | prefix_ | String to append to the beginning of system output. |
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 342 of file ScanInterface.cpp.
|
inlineprotectedvirtual |
Initialize the root output. Does nothing useful by default.
[in] | fname_ | Filename of the output root file. Not used by default. |
[in] | overwrite_ | Set to true if the user wishes to overwrite the output file. Not used by default. |
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 257 of file ScanInterface.hpp.
|
inline |
Return true if the ScanInterface object has been initialized.
Definition at line 88 of file ScanInterface.hpp.
|
inline |
Return true if verbose output mode is enabled.
Definition at line 91 of file ScanInterface.hpp.
|
inlineprotectedvirtual |
Notify the unpacker object of a user action. This method should be used in order to pass information to a class derived from Unpacker. Does nothing useful by default.
[in] | code_ | The notification code passed from ScanInterface methods. Not used by default. |
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 265 of file ScanInterface.hpp.
|
private |
Open a new binary input file for reading.
Open a new binary input file for reading.
[in] | fname_ | Input filename to open for reading. |
Definition at line 208 of file ScanInterface.cpp.
|
inlinevirtual |
Process all channel events read in from the rawEvent. This method should only be called from Unpacker::ProcessRawEvent().
Reimplemented in scopeScanner, and skeletonScanner.
Definition at line 167 of file ScanInterface.hpp.
|
private |
Seek to a specified position in the file.
Seek to a specified position in the file.
[in] | offset_ | The position, with respect to the start of the file, to seek to. |
Definition at line 180 of file ScanInterface.cpp.
void ScanInterface::RunControl | ( | ) |
Main scan control method.
Definition at line 437 of file ScanInterface.cpp.
|
inline |
Enable or disable batch processing mode.
Definition at line 139 of file ScanInterface.hpp.
|
inline |
Enable or disable debug mode.
Definition at line 130 of file ScanInterface.hpp.
|
inline |
Enable or disable dry run mode.
Definition at line 133 of file ScanInterface.hpp.
|
inline |
Set the header string used to prefix output messages.
Definition at line 121 of file ScanInterface.hpp.
|
inline |
Enable or disable shared memory mode.
Definition at line 136 of file ScanInterface.hpp.
bool ScanInterface::Setup | ( | int | argc, |
char * | argv[] | ||
) |
Setup user options and initialize all required objects.
Setup user options and initialize all required objects.
[in] | argc | Number of arguments passed from the command line. |
[in] | argv | Array of strings passed as arguments from the command line. |
We need to be able to handle mixed systems, which is not implemented yet.
Definition at line 838 of file ScanInterface.cpp.
|
inline |
Enable or disable verbose output mode.
Definition at line 127 of file ScanInterface.hpp.
|
inline |
Return true if shared memory mode is enabled.
Definition at line 100 of file ScanInterface.hpp.
|
private |
ncurses terminal used for displaying output and handling user input.
Start the scan.
Start the scan, if ScanInterface is initialized and is not already running.
Definition at line 122 of file ScanInterface.cpp.
|
private |
Stop the scan.
Stop the scan, if it is running.
Definition at line 145 of file ScanInterface.cpp.
|
protectedvirtual |
SyntaxStr is used to print a linux style usage message to the screen. Prints a standard usage message by default.
[in] | name_ | The name of the program. |
Reimplemented in scopeScanner, skeletonScanner, and UtkScanInterface.
Definition at line 333 of file ScanInterface.cpp.
|
protected |
Vector of all command line options.
Definition at line 174 of file ScanInterface.hpp.
|
private |
Set to true if shared memory mode is to be used.
Definition at line 298 of file ScanInterface.hpp.
|
protected |
Definition at line 178 of file ScanInterface.hpp.
|
private |
HRIBF HEAD buffer handler.
Definition at line 316 of file ScanInterface.hpp.
|
private |
Set to true if the user wishes verbose information to be displayed.
Definition at line 295 of file ScanInterface.hpp.
|
private |
PLD style DATA buffer handler.
Definition at line 314 of file ScanInterface.hpp.
|
private |
Set to true if the user wishes to display debug information.
Definition at line 296 of file ScanInterface.hpp.
|
private |
HRIBF DATA buffer handler.
Definition at line 317 of file ScanInterface.hpp.
|
private |
Input filename prefix (without extension).
Definition at line 278 of file ScanInterface.hpp.
|
private |
Maximum size of a spill to read.
Definition at line 285 of file ScanInterface.hpp.
|
private |
Main input binary data file.
Definition at line 308 of file ScanInterface.hpp.
|
private |
Set to true when ScanInterface is initialized properly and is ready to scan.
Definition at line 300 of file ScanInterface.hpp.
|
private |
The total number of good spills received from either the input file or shared memory.
Definition at line 288 of file ScanInterface.hpp.
|
private |
Main input file length (in bytes).
Definition at line 310 of file ScanInterface.hpp.
|
private |
HRIBF DIR buffer handler.
Definition at line 315 of file ScanInterface.hpp.
|
private |
Linux system current working directory.
Definition at line 280 of file ScanInterface.hpp.
|
private |
Poll2 shared memory server.
Definition at line 307 of file ScanInterface.hpp.
|
private |
Set to true if when the scan finishes.
Definition at line 293 of file ScanInterface.hpp.
|
private |
Set to true if the acqusition is running.
Definition at line 294 of file ScanInterface.hpp.
|
private |
Set to true when an input binary file is successfully opened for reading.
Definition at line 302 of file ScanInterface.hpp.
|
protected |
The name of the program.
Definition at line 173 of file ScanInterface.hpp.
|
private |
Definition at line 284 of file ScanInterface.hpp.
|
private |
Max size of shared memory buffer in pixie words (4050 + 2 header words)
Definition at line 275 of file ScanInterface.hpp.
|
private |
Definition at line 274 of file ScanInterface.hpp.
|
protected |
Definition at line 170 of file ScanInterface.hpp.
|
private |
Input file format to use (0=.ldf, 1=.pld, 2=.root).
Definition at line 287 of file ScanInterface.hpp.
|
protected |
User added command line options.
Definition at line 176 of file ScanInterface.hpp.
|
private |
Name of file to be used for output.
Definition at line 282 of file ScanInterface.hpp.
|
private |
PLD style HEAD buffer handler.
Definition at line 313 of file ScanInterface.hpp.
|
private |
Data structure for storing binary file header information.
Definition at line 312 of file ScanInterface.hpp.
|
private |
Set to true when run control thread has exited.
Definition at line 305 of file ScanInterface.hpp.
|
private |
Max size of shared memory buffer in bytes.
Definition at line 277 of file ScanInterface.hpp.
|
protected |
The string to print before program output.
Definition at line 171 of file ScanInterface.hpp.
|
private |
Set to true when user has sent kill command.
Definition at line 303 of file ScanInterface.hpp.
|
private |
Set to true if the program is to be run with no interactive command line.
Definition at line 299 of file ScanInterface.hpp.
|
private |
Linux user home directory.
Configuration file to be opened
Definition at line 281 of file ScanInterface.hpp.
|
private |
Set to true if a dry run is to be performed i.e. data is to be read but not processed.
Definition at line 297 of file ScanInterface.hpp.
|
private |
HRIBF EOF buffer handler.
Definition at line 319 of file ScanInterface.hpp.
|
private |
Set to true if raw channel counts are to be written to file.
Definition at line 292 of file ScanInterface.hpp.
|
protected |
Base level command line options for the scan.
Definition at line 175 of file ScanInterface.hpp.
|
private |
Input file extension.
Definition at line 279 of file ScanInterface.hpp.
|
private |
The first word in the file at which to start scanning.
Definition at line 290 of file ScanInterface.hpp.