BARS Namespace
BARS provides a set of high level functions and commonly used global variables and constants for use in scripts and BARS applications. These functions are available in the BARS
namespace.
Global constants
- BARS::Sys - contents of the
$BARSSYS
environment variable. - BARS::Cfg - path to
$BARSSYS/config/
- BARS::Res - path to
$BARSSYS/resources/
Functions and global variables for BARS applications
Functions and global variables for BARS applications are stored in the BARS::App
namespace.
Functions
Init BARS application
This function should be called at the beggining of each BARS application, as shown in example.
void BARS::App::Init(
int argc, char** argv,
const char* rcname,
std::function<void(int, char**)> parseOpts,
std::function<void(const char*)> readRC,
std::function<void()> checkParams);
Arguments:
- argc, argv - Input options
- rcname - Name of the default resource file (like "dtgen.rc").
- parseOpts - External function for parsing options.
- readRC - External function for reading resource file.
- checkParams - External to check parameter validity.
Check if file exists
Returns true if file exists. This function uses Linux stat and is likely faster than ROOT equivalent.
bool BARS::App::FileExists(const char* file);
bool BARS::App::FileExists(TString file);
bool BARS::App::FileExists(std::string file);
Init TelConfigManager
Some BARS modules still depend on a legacy component called BTelescope
. A function has been created to painlessly initialize it.
int BARS::App::InitTelConfigManager(const char* fnamein, const int season);
int BARS::App::InitTelConfigManager(); // If App::Season and App::Cluster are defined
It reads BRawMainInfo from fnamein and inits BTelConfigManager using BRawMainInfo.
Global variables
BARS::App
also contains a set of global variables common to BARS applications. These variables are provided as options to the example app so you don't have to add them to the parser. Many of them are also used in preinitialized file access functions to turn a call like this
BARS:App::File(1,2017, 102, BARS::App::SENSOR, "barsv051")
to calls like this:
BARS:App::File(BARS::App::SENSOR)
The list of common variables is below:
Type | Variable | Default value | Description |
---|---|---|---|
TString | BARS::App::Name | "GenericBARSApp" | App name |
TString | BARS::App::Output | "" | Output file path |
TString | BARS::App::Input | "" | Input file path |
TString | BARS::App::RCPath | "" | Resource file path |
TString | BARS::App::ProdId | "" | Production version |
bool | BARS::App::CustomRC | false | True if non-standard RC file is used |
int | BARS::App::FirstEvt | 0 | First event to process |
int | BARS::App::Iterations | 0 | Number of primary event loop iterations |
int | BARS::App::Run | -1 | Run ID (e.g. 110) |
int | BARS::App::Season | -1 | Season (e.g. 2016, 2017 etc) |
int | BARS::App::Cluster | -1 | Cluster (enumeration starts at 0!) |
int | BARS::App::Sdc | -1 | Section IP address |
Accessing data files
Data file access functions are contained in the BARS::Data
namespace.
Global variables
- BARS::Data::RawPath - path to raw telescope data. For example
/mnt/data3/raw_full/
- BARS::Data::ProcessedPath - path to processed telescope data. For example
/mnt/cephfs/
- BARS::Data::JointPath - path to joint telescope data. For example
/mnt/cephfs/
BARS::App::Init
initializes these paths to the environment variables specified in the installation guide.
Data file types
BARS::Data::Type
is an enum that encodes different types of data files used in BARS. The full list of the types is provided below. $SDC
should be replaced by an appropriate master address.
BARS::Data::Type | Suffix | Description |
---|---|---|
BEVENT | bevent | |
COMMUTATOR | raw.commutator | |
CONFIG | raw.config | |
ERROR | raw.errors | |
FADC_SLICE | extr.events.$SDC | |
FADC_SLICE_SORTED | extr.events.$SDC.sorted | |
EXTR_EVENTS_STAR_SORTED | extr.events.*.sorted | |
HISTOGRAM | raw.histogram | |
INDEX | index.events.$SDC | |
JOINT_TABLE | joint_table | |
JOINT | joint.events | |
JOINT_MARKED | joint.events.marked | |
MASTEROUT | raw.events.* | |
MASTERIN | raw.events.[0-9][0-9][0-9] | |
MASTERSDC | raw.events.$SDC | |
MASTER_STAT | masterstat | |
MASTER_SORTED | raw.events.$SDC.sorted | |
MASTER_STAR_SORTED | raw.events.*.sorted | |
MESSAGE | raw.messages | |
MONITOR_DUMP | raw.monitordump | |
MONITOR_INFO | raw.monitorinfo | |
RUN_INFO | runinfo | |
RUN_INFOTXT | runinfo | |
SENSOR | raw.sensor | |
UTIL | raw.utils | |
RAWFILE1 | 001 | |
RAWFILES | [0-9][0-9][0-9] | |
SECTION_MASK | section.mask | |
SECTION_INFO | sectioninfo | |
SECTION_INFO_TXT | sectioninfo | |
TRIGGER_STAR_SORTED | raw.trigger.*.sorted | |
GLOBAL_TRIGGER | global.triggers | |
HIST_TRIGGER | hists.triggers |
Data access functions
Get name of a data file
const char* BARS::Data::Filename(UInt_t season, UInt_t cluster, UInt_t run, Type dtype, UInt_t sdc = 0);
Arguments:
- season - 2016, 2017, 2018 etc.
- cluster - number of cluster, starting with 0.
- run - run number.
- dtype - type of the data file (see data file types).
- sdc - master address (for example, 192 or 204).
Get directory of a data file
const char* BARS::Data::Directory(UInt_t cluster, UInt_t season, UInt_t run, Type dtype, const char* prod_id, UInt_t sdc = 0);
Arguments:
- cluster - number of cluster, starting with 0.
- season - 2016, 2017, 2018 etc.
- run - run number.
- dtype - type of the data file (see data file types).
- prod_id - production id.
- sdc - master address (for example, 192 or 204).
Get full path of a data file
const char* BARS::Data::File(UInt_t cluster, UInt_t season, UInt_t run, Type dtype, const char* prod_id, UInt_t sdc = 0);
Arguments:
- cluster - number of cluster, starting with 0.
- season - 2016, 2017, 2018 etc.
- run - run number.
- dtype - type of the data file (see data file types).
- prod_id - production id.
- sdc - master address (for example, 192 or 204).
Preinitialized data access functions
If you have initialized global application variables in BARS::App
you can use the more concise data access functions:
const char* BARS::Data::Filename(Type dtype, UInt_t sdc = 0);
const char* BARS::Data::Directory(Type dtype, UInt_t sdc = 0);
const char* BARS::Data::File(Type dtype, UInt_t sdc = 0);
The variables you need initialize, are:
- App::Run
- App::Cluster
- App::Season
- App::ProdId
Please note, that an example application has an option for each of these variables.
Accessing calibration files
Calibration table access functions are contained in the BARS::Calib
namespace.
Calibration file types
There are several calibration file types. Each is encoded by a BARS::Calib::Type
enum:
BARS::Calib::Type | Description |
---|---|
TIME | Time calibration |
AMPLITUDE | Amplitude calibration |
CHARGE | Charge calibration |
PEDESTAL | Pedestal calibration |
OFFSET | Section offsets |
CHMASK | Channel mask |
Get absolute path of a calibration file
To get an absolute path of a calibration table, use the following function:
const char* BARS::Calib::File(UInt_t cluster, UInt_t season, Type ctype, const char* name)
Arguments:
- cluster - number of cluster, starting with 0.
- season - 2016, 2017, 2018 etc.
- ctype - type of calibration (see calibration file types).
- name - name of a calibration file (like timecalib_dzh).
If you have initialized global application variables in BARS::App
you can use the more concise calibration access function:
const char* BARS::Data::File(Type ctype, const char* name);
The variables you need initialize, are:
- App::Cluster
- App::Season
Please note, that an example application has an option for each of these variables.
Accessing geometry data
Geometry access functions are contained in the BARS::Geom
namespace.
Geometry file types
Geometry file types are encoded in the BARS::Geom::Type
enum as show below:
BARS::Geom::Type | Description |
---|---|
TEXT | Plain text CSV file with measurements |
EXPORT_RAW | Files with beacon coordinates (tree per beacon) |
EXPORT_FILTERED | Files with filtered beacon coordinates (tree per beacon) |
EXPORT_COMBINED | Files with beacon coordinates (single tree) |
EXPORT_COMBINED_FILT | Files with filtered beacon coordinates (single tree) |
DYNAMICS | Dynamic beacon data (velocity etc) |
ALIGNED | Aligned beacon coordinates |
ALIGNED_GUESSED | Aligned beacon coordinates (missing data guessed) |
OM_EXPORT_LINEAR | Exported OM coordinates |
BASE_COORDINATES | Base antenna coordinates |
QUALITY | Data quality metrics |
LAYOUT | Static beacon configuration |
INITIAL_COORDINATES | Initial coordinates for each beacon (for guessing) |
CLUSTER_TEMPLATE | Configuration file determines layout for each string |
Please see acoustics production page for more info.
Get absolute path of a geometry file
To get an absolute path of a geometry file, use the following function:
const char* BARS::Geom::File(UInt_t cluster, UInt_t season, Type type, UInt_t laser = 0, const char* id=0)
Arguments:
- cluster - number of cluster, starting with 0.
- season - 2016, 2017, 2018 etc.
- type - type of a geometry file (see geometry file types).
- laser - laser id. If not 0, will look for laser positioning data, rather than cluster positioning.
- id - a prefix for the geometry file, if any. Most users won;t need that.
If you have initialized global application variables in BARS::App
you can use the more concise calibration access function:
const char* BARS::Geom::File(Type type, UInt_t laser = 0, const char* id);
The variables you need to initialize, are:
- App::Cluster
- App::Season
Please note, that an example application has an option for each of these variables.