LArIAT production database¶
There is a LArIAT production PostgreSQL database, lariat_prd
on ifdbprod2.fnal.gov:5443
, that is to be used for production jobs (and, of course, for work leading up to these jobs). There are currently three tables in the database:
- An IFBeam DB (Beam Conditions Database for Intensity Frontier Experiments) table,
lariat_ifbeam_database
- A DAQ XML configuration table,
lariat_xml_database
- The LArIAT hardware connections database (LHCdb) table,
lariat_hardware_connections
In LArIAT, a single run can have anywhere from 1 to 9999 sub-runs. Each sub-run is 1 minute long, and contains a ~4.2-second-long beam spill followed by a ~25-second-long cosmic data-taking period. Most sub-runs in Run II also have one second of pre-beam pedestal events, vetoed by scintillation light in the TPC.
At the beginning of each run, the DAQ reads in a set of configurable parameters from XML files (sampling rate of digitizers, digitizer pedestal settings, WC TDC thresholds, ASIC gain settings, ..., etc.). All of these parameters are written to a small xml file at the beginning of a run, to be added and stored in the lariat_xml_database
table at the end of the first sub-run.
During each sub-run, various readings of voltages and currents of devices controllable through ACNET (current of dipole magnets, voltages of wire planes and cathode, HV of light collection PMTs, HV of beam-line PMTs, ..., etc.) are recorded by ACNET and stored to a database called IFBEAM. At the end of the sub-run these are stored in the lariat_ifbeam_database
table by the Xporter script, which also moves the data file to the File Transfer System dropbox, where it is automatically registered to SAM and moved to permanent storage on /pnfs/lariat/raw/
.
LArIAT database utility¶
We have an art
service called DatabaseUtilityT1034
that is designed for users' code to query the database for parameters that they might need for calibrations, reconstruction, analysis, etc. The code lives in the lariatsoft repository:
lariatsoft/Utilities/DatabaseUtilityT1034.h lariatsoft/Utilities/DatabaseUtilityT1034_service.cc lariatsoft/Utilities/databaseutility_lariat.fcl
There is an example of how to use the DatabaseUtilityT1034
service in the LArIATSoft repository here:
lariatsoft/LArIATAnaModule/DatabaseExample_module.cc lariatsoft/LArIATAnaModule/DatabaseExample.fcl
The important thing to note is that the lariat_xml_database
table has one row for each run, so it only makes sense to query this table in the beginRun()
method of your analyzer or producer module. The lariat_ifbeam_database
table, however, has one row for each SUB-RUN, so this table should be queried in the beginSubRun()
method of your analyzer of producer module.
To see a full list of the parameters used, go to the LArIAT Run Summary page. You will have to select a run to view the list of parameters.
Member functions of DatabaseUtilityT1034¶
There are main 2 ways of querying the database tables:
- Ask for a single parameter, which returns the parameter as a string
- Ask for multiple parameters, which returns a std::map< std::string, std::string > where the key is the parameter name and the mapped value is the parameter value.
Member functions of the DatabaseUtilityT1034 class:
// These methods are used to query the lariat_xml_database table, and should be used in the beginRun() method. std::string GetConfigValue(std::string parameterName, int runNumber); // 1 std::map< std::string, std::string > GetConfigValues(std::vector< std::string > parameterNames, int runNumber); // 2 std::map< std::string, std::string > GetAllConfigValues(int runNumber); // 3 // These methods are used to query the lariat_ifbeam_database table, and should be used in the beginSubRun() method. std::string GetIFBeamValue(std::string parameterName, int runNumber, int subRunNumber); // 4 std::map< std::string, std::string > GetIFBeamValues(std::vector< std::string > parameterNames, int runNumber, int subRunNumber); // 5 std::map< std::string, std::string > GetAllIFBeamValues(int runNumber, int subRunNumber); // 6
- Returns a single specified parameter from the
lariat_xml_database
table for the specified run as a string. - Returns parameters specified in the
parameterNames
vector from thelariat_xml_database
table for the specified run as a map. - Returns all parameters from the
lariat_xml_database
table for the specified run as a mpt. - Returns a single specified parameter from the
lariat_ifbeam_database
table for the specified sub-run as a string. - Returns parameters specified in the
parameterNames
vector from thelariat_ifbeam_database
table for the specified sub-run as a map. - Returns all parameters from the
lariat_ifbeam_database
table for the specified sub-run as a map.
Troubleshooting¶
Cannot connect to database¶
If you are getting the following messages while running a module, your LArIATSoft setup may not be picking up the password file for accessing the lariat_prd
database.
Attempting to connect to database... Connection to database failed: fe_sendauth: no password supplied Attempting to reconnect to database... attempt number 1 Connection to database failed: fe_sendauth: no password supplied Attempting to reconnect to database... attempt number 2 Connection to database failed: fe_sendauth: no password supplied Attempting to reconnect to database... attempt number 3 Connection to database failed: fe_sendauth: no password supplied
If this occurs, please try running the following command before attempting to run the module again:
$ setup lariatsoft $LARIATSOFT_VERSION -q $MRB_QUALS
If that doesn't work, you may have to resort to setting the FW_SEARCH_PATH
environment variable manually:
$ export FW_SEARCH_PATH=$MRB_INSTALL/lariatsoft/$LARIATSOFT_VERSION/pwd:$FW_SEARCH_PATH