Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Running the Tool

The tool conditions CommandLineTool can be run using the java command after Installing HPS Java.

Code Block
languagebash
themeMidnight
java -cp ./distribution/target/hps-distribution-3.7-SNAPSHOT-bin.jar org.hps.conditions.cli.CommandLineTool

The This automatically generated run script can also may be used equivalently.

Code Block
languagebash
themeMidnight
./distribution/target/appassembler/bin/conditions-cli.sh

Without any arguments these the commands will print the command basic usage information and then exit.

No Format
usage: CommandLineTool
Commands:
tag
run-summary
load
add
print
 -d,--detector <arg>     detector name
 -h,--help               print help
 -p,--connection <arg>   database connection properties file
 -r,--run <arg>          run number
 -t,--tag <arg>          conditions tag to use for filtering records
 -x,--xml <arg>          conditions XML configuration file

...

These options should be provided before the sub-command, as in this example.

Code Block
languagebash
./distribution/target/appassembler/bin/conditions-cli.sh tag -p myconnection.prop -d HPS-dummy-detector -r 1234 [subcommand]

Options after the sub-command are will be passed to that sub-commands command's parser and not processed as general options (similar to how the svn command works).

Commands

Tag Command

The tag command is used to make a conditions tag that can be used to filter records.

Tag

...

 Options Table

Short OptionLong OptionDescription
-D--dont-promptdon't prompt before making tag (be careful!)
-t--tagname of tag
-s--run-startstart run number
-e--run-endend run number
-m--multipleaction for disambiguation of multiple valid records of the same type in the run
-h--helpprint help and exit

Here is a dummy example of using the tag command.

Code Block
languagebash
./distribution/target/appassembler/bin/conditions-cli.sh tag -s 42 -e 1001 -m LAST_CREATED -t test-tag-1

...

The run-summary command can print out conditions collections that will be used for a given run.

Run Summary Options Table

Short OptionLong OptionDescription
-a --allprint out collection records and not just summary information
-h--helpprint help and exit

To use this, command the -d and -r base options should be used to initialize the conditions system.

Code Block
languagebash
./distribution/target/appassembler/bin/conditions-cli.sh tag -p myconnection.prop -d HPS-dummy-detector -r 1234 run-summary

If this information is not provided then the conditions system cannot be initialized and an error will occur.

Load Command

The load command is used to insert new conditions collections into the database.

Load Options Table

Short OptionLong OptionDescription
-a --allprint out collection records and not just summary information
-h--helpprint help and exit

Here is an example of using the load command.

Code Block
conditions-cli.sh load -d "adding new ECal calibrations" -f ecal_calibrations.txt -t ecal_calibrations

The data for formatting should be in CSV format similar to the following.

No Format
ecal_channel_id,pedestal,noise
1,123.40,3.45
[...]

The first row should contain column headers but the id and collection_id fields should always be omitted.

This command requires write access to the database so a connection properties file must be provided.

Add Command

The add command is used to associate an existing conditions collection with a range of run numbers.

Add Options Table

Short OptionLong OptionDescription
-c --collection

collection ID of the data

-r--run-startstarting run number
-e--run-end

ending run number

defaults to run start if not provided

-m--notesprovide notes about this conditions set
-t--tablename of conditions table in database
-u--useryour user name (computer account name is fine)
-h--helpprint help and exit

Here is an example of using the add command.

Code Block
languagebash
conditions-cli.sh add -c 1234 -s 5000 -e 5001 -m "ECal calibrations for 5000 and 5001" -t ecal_calibrations -u jeremym

This command requires write access to the database so a connection properties file must be provided.

The collection ID can be found by looking at the collection_id column in the individual data tables.  It is also printed out when using the load command to add new data.

Print Command

The print command is used to print out detailed collection information for a given run number.

Print Options Table

Short OptionLong OptionDescription
-h--help

print help and exit

-t--table

data table name

if not provided all collections for the run will be printed

-i--print-id

include the row ID in print outs

-f--file

instead of printing to screen write output to a CSV file

the -t option must also be provided or an error will occur

-H--no-headerdo not print collection header information
-h--helpprint help and exit

Here is an example of using print to show all collections from a run.

Code Block
languagebash
conditions-cli.sh -r 5000 -d HPS-EngRun2015-Nominal-v3 print

This command will save the given table data for the run to an output CSV file.

Code Block
conditions-cli.sh -r 5000 -d HPS-EngRun2015-Nominal-v3 print -t ecal_calibrations -f ecal_calibrations_saved.txt

The print command requires that the base -r and -d options are provided to initialize the conditions system or an error will occur.