What's a static configuration?
When working with the GVD data, you'll likely need to:
- Iterate over channels in a string, section or a cluster.
- Iterate over sections or strings in a cluster.
- Determine which string does a section with a specific FADC address belong to.
- Determine which section or string does a channel belong to.
- Determine the number of channels in a section, a string or a cluster.
- Determine the number of strings in a cluster.
- etc, etc, etc
The hierarchical structure of the detector is called its static configuration. The static configuration describes:
- The hierarchy of the GVD components: which channel belongs to which section, which section belongs to which string etc.
- Static parameters of GVD components - serial numbers, hardware versions etc.
In short, the static configuration describes every aspect of the detector that can't be changed over a season.
Usage
BARS provides the BStaticConfig
object to describe and query the static configuration of the detector.
It provides an interface for the plain text static configuration tables stored in $BARSSYS/config/season/static
.
All enumerations start at 0 (e.g. cluster #1 is the second cluster)
Static configuration for GVD
Static configuration for the detector is stored in an object of class BStaticConfig
.
You can create and initialize it as follows:
BStaticConfig cfg(2017, "bars/config/");
This will read the entire static configuration of the GVD in season 2017 into cfg
.
You can use cfg
to query general information about the detector:
cfg.GetNClusters(); // 2 - get total number of clusters in the detector
cfg.GetNStrings(); // 16 - get total number of strings in the detector
cfg.GetNSections(); // 48 - get total number of sections in the detector
cfg.GetNChannels(); // 576 - get total number of channels in the detector
cfg.WhiteRabbitMasterExists(); // True if WR system is present in the GVD
cfg.SyncMasterExists(); // True if th sync master is present in the GVD
From this object you can access static configurations of individual components of the detector:
// Clusters
cfg.GetCluster(1); // Get static configuration for the second cluster
// Strings
cfg.GetString(12); // Get static configuration for the 12th string
cfg.GetString(1,5); // Get static configuration for string #5, cluster #1 (all from 0)
// Sections
cfg.GetSection(5); // Get static configuration for the 5th section
cfg.GetSection(10, 1); // Get static configuration for section #10, cluster #1
cfg.GetSection(2, 1, 3); // Get static configuration for top section, string #3, cluster #1
cfg.GetSection(1, 1, 3); // Get static configuration for middle section, string #3, cluster #1
cfg.GetSection(0, 1, 3); // Get static configuration for bottom section, string #3, cluster #1
// Channels
cfg[320]; // Get static configuration for channel #320
cfg.GetChannel(320); // Get static configuration for channel #320
cfg.GetChannel(200, 1); // Get static config for channel #200, cluster #1
cfg.GetChannel(15, 1, 3); // Get static configuration for channel #15, cluster #1, string #3
cfg.GetChannel(5, 1, 3, 2); // Get static configuration for channel #5, cluster #1, string #3, top section
Static channel configuration
Static configuration for each channel is stored in a BStaticConfig::Channel
object.
It contains:
- Absolute channel # in the detector, cluster, string and section
- Section # number and position on string
- Cluster #
- PMT #
- Cable serial number and season
- OM serial and season
- Calibration LED configuration
- Sensor configuration
How to get static config for a channel
Here's how you can get static channel configuration from BStaticConfig
:
// Get 320th channel
BStaticConfig::Channel c = cfg[320];
// Other ways to get this channel:
// ... by #
cfg.GetChannel(320);
cfg[320];
// ... by # relative to cluster
cfg.GetChannel(32, 1);
cfg.GetCluster(1).GetChannel(32);
cfg.GetCluster(1)[32];
// ... by # relative to string
cfg.GetChannel(32, 1, 0)
cfg.GetCluster(1).GetString(0).GetChannel(32);
cfg.GetCluster(1).GetString(0)[32];
// ... by # relative to section
cfg.GetChannel(8, 1, 0, 2);
cfg.GetCluster(1).GetString(0).GetSection(0).GetChannel(2);
cfg.GetCluster(1).GetString(0).GetSection(0)[2];
How to use static channel config
Once you have the channel object, you can query it for static parameters:
BStaticConfig::Channel c = cfg[320];
ch320.GetId(); // 320
ch320.GetLocalId(); // 8 - this is 8th channel in section
ch320.GetSection(); // 26 - this channel is on 26th section
ch320.GetSectionLocal();// 2 - this channel is on a top section (0-bottom, 1 - center, 2 - top)
ch320.GetString(); // 8 - this channel is on the 8th string (absolute enumeration)
ch320.GetStringLocal(); // 0 - this channel is on the first string in its cluster
ch320.GetCluster(); // 1 - this channel belongs to the second cluster
ch320.GetIdInString(); // 32 - this is channel #32 in its string
ch320.GetIdInCluster(); // 32 - this is channel #32 in its cluster
// This values are not yet in config files,
// so the following calls will return default
// values for now.
ch320.GetPMTSerial(); // PMT serial number (MA....)
ch320.GetCableYear(); // Year of the OM cable series
ch320.GetCableSerial(); // Serial number of OM cable
ch320.GetOMYear(); // Year of OM series (2017 onwards)
ch320.GetOMSerial(); // OM serial number (2017 onwards)
ch320.HasSensors(); // True if OM has sensors (inclinometer/thermal etc) installed
ch320.TopsideLEDs(); // True if LEDs are positioned on top of the OM
Static section configuration
Static configuration for each section is stored in a BStaticConfig::Section
object.
It contains:
- Absolute number of the section
- FADC address (200, 198 etc)
- Cluster #
- Section # relative to string or cluster
- Number of channels in section
- Serial and season of the section cable
You can also use it to obtain static configurations for the channels of the section.
How to get static section configuration
// These are different ways to get same section:
// ... by #
BStaticConfig::Section section26 = cfg.GetSection(26);
// ... by # relative to cluster
cfg.GetSection(2,1);
cfg.GetCluster(1).GetSection(2);
// ... by # relative to string
cfg.GetSection(2,1,0); //2 section, cluster 1, string 0
cfg.GetCluster(1).GetString(0).GetSection(2);
How to use static section configuration
section26[2]; // Get 2nd channel
section26.GetChannel(2); // Get 2nd channel
section26.GetNChannels(); // 12
section26.GetId(); // 26 - absolute # of section
section26.GetLocalId(); // 2 - # of section relative to string
section26.GetCluster(); // 1 - # of cluster that contains channel
section26.GetString(); // 8 - # of string that contains channel
section26.GetMasterAddress(); // Get IP of the section's master
// The following getters work, but currently return zeros
// it will change the moment I update the data in plaintext
// configurations
ch320.GetCableYear(); // Year of the section cable series
ch320.GetCableSerial(); // Serial number of the section cable
Static string configuration
Static configuration for each string is stored in a BStaticConfig::String
object.
It contains:
- Absolute number of the string
- Number of the string in cluster
- Cluster #
- Number of channels and sections in the string
You can also use it to obtain static configurations for strings, sections and channels of the cluster.
How to get static string config
// These are different ways to get same string
// ... by #
BStaticConfig::String string8 = cfg.GetString(8);
// ... by # relative to cluster
cfg.GetString(1,0);
cfg.GetCluster(1).GetString(0);
How to use static string config
string8[32]; // Get 32nd channel
string8.GetChannel(32); // Get 32nd channel
string8.GetNChannels(); // 36
string8.GetId(); // 8 - absolute # of string
string8.GetLocalId(); // 0 - # of string, relative to cluster
string8.GetCluster(); // 1 - # of cluster
string8.GetNSections(); // 3 - number of sections in string
string8.GetSection(2); // Get top section
string8.GetSection(1); // Get middle section
string8.GetSection(0); // Get bottom section
Static cluster configuration
Static configuration for each cluster is stored in a BStaticConfig::Cluster
object.
It contains:
- Absolute number of the cluster
- Number of channels, strings and sections in the cluster
You can also use it to obtain static configurations for strings, sections and channels of the cluster.
How to get static cluster config
Here's how you can get static cluster configuration from BStaticConfig
:
BStaticConfig::Cluster cluster1 = cfg.GetCluster(1);
How to use static cluster config
cluster1[32]; //Get 32nd channel in cluster
cluster1.GetChannel(32); //Get 32nd channel in cluster
cluster1.GetNChannels(); // 288
cluster1.GetId(); // 1 - absolute # of cluster
cluster1.GetNStrings(); // 8
cluster1.GetNSections(); // 24
cluster1.GetString(0); // Get first string
cluster1.GetMaster(200); // Get section with FADC address #200
Use cases
Iterating over channels
Please use the following snippets to iterate over channels in a GVD component:
// Print all channels in detector
for (auto channel : cfg) channel->Print();
// Print all channels in first cluster
for (auto channel : cfg.GetCluster(0)) channel->Print();
// Print all channels in top section of string 8, cluster 1
for (auto channel : cfg.GetSection(2,0,7)) channel->Print();
Get section by the master id
You can get a static configuration for a section by providing it's master id and a cluster #
cfg.GetCluster(0).GetMaster(200)