use assert_cmd::Command; const HELP_STR: &str = "Read out information of a grid Usage: pineappl read <--orders|--orders-spaces|--orders-long|--bins|--channels|--fktable|--ew|--get |--keys|--qcd|--show> Arguments: Path to the input grid Options: -o, --orders Show the orders of a grid, stripping zero powers --orders-spaces Show the orders of a grid, replacing zero powers with spaces --orders-long Show the orders of a grid, including zero powers -b, --bins Show the bins of a grid --channels Show the channel definition of a grid --fktable Check if input is an FK table --ew For each order print a list of the largest EW order --get Gets an internal key-value pair --keys Show all keys stored in the grid --qcd For each order print a list of the largest QCD order --show Shows all key-value pairs stored in the grid -h, --help Print help "; const BINS_STR: &str = "b etal norm -+----+----+---- 0 2 2.25 0.25 1 2.25 2.5 0.25 2 2.5 2.75 0.25 3 2.75 3 0.25 4 3 3.25 0.25 5 3.25 3.5 0.25 6 3.5 4 0.5 7 4 4.5 0.5 "; const CHANNELS_STR: &str = "c entry entry -+------------+------------ 0 1 × ( 2, -1) 1 × ( 4, -3) 1 1 × (21, -3) 1 × (21, -1) 2 1 × (22, -3) 1 × (22, -1) 3 1 × ( 2, 21) 1 × ( 4, 21) 4 1 × ( 2, 22) 1 × ( 4, 22) "; const ORDERS_STR: &str = "o order -+---------------- 0 O(a^2) 1 O(as^1 a^2) 2 O(as^1 a^2 lr^1) 3 O(as^1 a^2 lf^1) 4 O(a^3) 5 O(a^3 lr^1) 6 O(a^3 lf^1) "; const ORDERS_LONG_STR: &str = "o order -+--------------------- 0 O(as^0 a^2 lr^0 lf^0) 1 O(as^1 a^2 lr^0 lf^0) 2 O(as^1 a^2 lr^1 lf^0) 3 O(as^1 a^2 lr^0 lf^1) 4 O(as^0 a^3 lr^0 lf^0) 5 O(as^0 a^3 lr^1 lf^0) 6 O(as^0 a^3 lr^0 lf^1) "; const ORDERS_SPACES_STR: &str = "o order -+--------------------- 0 O( a^2 ) 1 O(as^1 a^2 ) 2 O(as^1 a^2 lr^1 ) 3 O(as^1 a^2 lf^1) 4 O( a^3 ) 5 O( a^3 lr^1 ) 6 O( a^3 lf^1) "; const FKTABLE_STR: &str = "no multiple orders detected "; const WRONG_ORDERS_STR: &str = "error: the argument '--orders' cannot be used with '--orders-long' Usage: pineappl read <--orders|--orders-spaces|--orders-long|--bins|--channels|--fktable|--ew|--get |--keys|--qcd|--show> For more information, try '--help'. "; const KEYS_STR: &str = "arxiv description hepdata initial_state_1 initial_state_2 lumi_id_types mg5amc_repo mg5amc_revno nnpdf_id pineappl_gitversion results runcard runcard_gitversion x1_label x1_label_tex x1_unit y_label y_label_tex y_unit "; const SHOW_STR: &str = r#"arxiv: 1505.07024 description: LHCb differential W-boson production cross section at 7 TeV hepdata: 10.17182/hepdata.2114.v1/t4 initial_state_1: 2212 initial_state_2: 2212 lumi_id_types: pdg_mc_ids mg5amc_repo: http://bazaar.launchpad.net/~maddevelopers/mg5amcnlo/3.1.2/ mg5amc_revno: 983 nnpdf_id: LHCBWZMU7TEV pineappl_gitversion: v0.4.1-114-gdce19e0 results: ---------------------------------------------------------------------- PineAPPL MC sigma central min max 1/100 sigma 1/1000 1/1000 1/1000 ---------------------------------------------------------------------- 3.772955e+02 3.772821e+02 0.165 0.022 0.0357 0.0392 0.0313 3.451417e+02 3.451342e+02 0.179 0.012 0.0217 0.0251 0.0172 3.001260e+02 3.001231e+02 0.029 0.033 0.0096 0.0104 0.0076 2.427612e+02 2.427624e+02 0.024 0.021 0.0049 0.0046 0.0060 1.809773e+02 1.809799e+02 0.023 0.062 0.0143 0.0134 0.0154 1.229334e+02 1.229354e+02 0.028 0.056 0.0157 0.0120 0.0200 1.158685e+02 1.158603e+02 0.029 0.245 0.0708 0.0859 0.0514 2.751727e+01 2.749798e+01 0.074 0.944 0.7014 0.7554 0.6281 runcard:
3.1.1 ###################################################################### ## PARAM_CARD AUTOMATICALY GENERATED BY MG5 #### ###################################################################### ################################### ## INFORMATION FOR MASS ################################### BLOCK MASS # 6 1.725000e+02 # mt 23 9.115350e+01 # mz 24 8.035200e+01 # mw 25 1.250000e+02 # mh 1 0.000000e+00 # d : 0.0 2 0.000000e+00 # u : 0.0 3 0.000000e+00 # s : 0.0 4 0.000000e+00 # c : 0.0 5 0.000000e+00 # b : 0.0 11 0.000000e+00 # e- : 0.0 12 0.000000e+00 # ve : 0.0 13 0.000000e+00 # mu- : 0.0 14 0.000000e+00 # vm : 0.0 15 0.000000e+00 # ta- : 0.0 16 0.000000e+00 # vt : 0.0 21 0.000000e+00 # g : 0.0 22 0.000000e+00 # a : 0.0 9000002 9.118800e+01 # ghz : mz 9000003 8.041900e+01 # ghwp : mw 9000004 8.041900e+01 # ghwm : mw 250 9.118800e+01 # g0 : mz 251 8.041900e+01 # g+ : mw ################################### ## INFORMATION FOR SMINPUTS ################################### BLOCK SMINPUTS # 2 1.166379e-05 # gf 3 1.180000e-01 # as (note that parameter not used if you use a pdf set) ################################### ## INFORMATION FOR DECAY ################################### DECAY 6 1.377580e+00 # wt DECAY 23 2.494300e+00 # wz DECAY 24 2.084000e+00 # ww DECAY 25 4.074680e-03 # wh DECAY 1 0.000000e+00 # d : 0.0 DECAY 2 0.000000e+00 # u : 0.0 DECAY 3 0.000000e+00 # s : 0.0 DECAY 4 0.000000e+00 # c : 0.0 DECAY 5 0.000000e+00 # b : 0.0 DECAY 11 0.000000e+00 # e- : 0.0 DECAY 12 0.000000e+00 # ve : 0.0 DECAY 13 0.000000e+00 # mu- : 0.0 DECAY 14 0.000000e+00 # vm : 0.0 DECAY 15 0.000000e+00 # ta- : 0.0 DECAY 16 0.000000e+00 # vt : 0.0 DECAY 21 0.000000e+00 # g : 0.0 DECAY 22 0.000000e+00 # a : 0.0 DECAY 250 2.498770e+00 # g0 : wz DECAY 251 2.092910e+00 # g+ : ww ################################### ## INFORMATION FOR QNUMBERS 9000001 ################################### BLOCK QNUMBERS 9000001 # gha 1 0 # 3 times electric charge 2 1 # number of spin states (2s+1) 3 1 # colour rep (1: singlet, 3: triplet, 8: octet) 4 1 # particle/antiparticle distinction (0=own anti) ################################### ## INFORMATION FOR QNUMBERS 9000002 ################################### BLOCK QNUMBERS 9000002 # ghz 1 0 # 3 times electric charge 2 1 # number of spin states (2s+1) 3 1 # colour rep (1: singlet, 3: triplet, 8: octet) 4 1 # particle/antiparticle distinction (0=own anti) ################################### ## INFORMATION FOR QNUMBERS 9000003 ################################### BLOCK QNUMBERS 9000003 # ghwp 1 3 # 3 times electric charge 2 1 # number of spin states (2s+1) 3 1 # colour rep (1: singlet, 3: triplet, 8: octet) 4 1 # particle/antiparticle distinction (0=own anti) ################################### ## INFORMATION FOR QNUMBERS 9000004 ################################### BLOCK QNUMBERS 9000004 # ghwm 1 -3 # 3 times electric charge 2 1 # number of spin states (2s+1) 3 1 # colour rep (1: singlet, 3: triplet, 8: octet) 4 1 # particle/antiparticle distinction (0=own anti) ################################### ## INFORMATION FOR QNUMBERS 9000005 ################################### BLOCK QNUMBERS 9000005 # ghg 1 0 # 3 times electric charge 2 1 # number of spin states (2s+1) 3 8 # colour rep (1: singlet, 3: triplet, 8: octet) 4 1 # particle/antiparticle distinction (0=own anti) ################################### ## INFORMATION FOR QNUMBERS 250 ################################### BLOCK QNUMBERS 250 # g0 1 0 # 3 times electric charge 2 1 # number of spin states (2s+1) 3 1 # colour rep (1: singlet, 3: triplet, 8: octet) 4 0 # particle/antiparticle distinction (0=own anti) ################################### ## INFORMATION FOR QNUMBERS 251 ################################### BLOCK QNUMBERS 251 # g+ 1 3 # 3 times electric charge 2 1 # number of spin states (2s+1) 3 1 # colour rep (1: singlet, 3: triplet, 8: octet) 4 1 # particle/antiparticle distinction (0=own anti) order = NLO fixed_order = ON shower = OFF madspin = OFF reweight = OFF madanalysis = OFF runshower = False /FixedOrderAnalysis/ ( is the name of the exported # process directory). See the # /FixedOrderAnalysis/analysis_*_template.f file for details # on how to write your own analysis. # ####################################################################### # # Analysis format. # Can either be 'topdrawer', 'root', 'HwU', 'LHE' or 'none'. # When choosing HwU, it comes with a GnuPlot wrapper. When choosing # topdrawer, the histogramming package 'dbook.f' is included in the # code, while when choosing root the 'rbook_fe8.f' and 'rbook_be8.cc' # are included. If 'none' is chosen, all the other entries below have # to be set empty. FO_ANALYSIS_FORMAT = HwU # # # Needed extra-libraries (FastJet is already linked): FO_EXTRALIBS = # # (Absolute) path to the extra libraries. Directory names should be # separated by white spaces. FO_EXTRAPATHS = # # (Absolute) path to the dirs containing header files needed by the # libraries (e.g. C++ header files): FO_INCLUDEPATHS = # # User's analysis (to be put in the /FixedOrderAnalysis/ # directory). Please use .o as extension and white spaces to separate # files. FO_ANALYSE = LHCB_WP_7TEV.o # # ## When linking with root, the following settings are a working ## example on lxplus (CERN) as of July 2014. When using this, comment ## out the lines above and replace with the physical ## path to root, ## e.g. /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.11/x86_64-slc6-gcc46-dbg/root/ #FO_ANALYSIS_FORMAT = root #FO_EXTRALIBS = Core Cint Hist Matrix MathCore RIO dl Thread #FO_EXTRAPATHS = /lib #FO_INCLUDEPATHS = /include #FO_ANALYSE = analysis_root_template.o ]]>
runcard_gitversion: 82de4ad x1_label: etal x1_label_tex: $\eta_{\bar{\ell}}$ x1_unit: y_label: dsig/detal y_label_tex: $\frac{\mathrm{d}\sigma}{\mathrm{d}\eta_{\bar{\ell}}}$ y_unit: pb "#; const WRONG_ARGUMENTS_STR: &str = "error: the argument '--ew' cannot be used with '--qcd' Usage: pineappl read <--orders|--orders-spaces|--orders-long|--bins|--channels|--fktable|--ew|--get |--keys|--qcd|--show> For more information, try '--help'. "; #[test] fn help() { Command::cargo_bin("pineappl") .unwrap() .args(["read", "--help"]) .assert() .success() .stdout(HELP_STR); } #[test] fn bins() { Command::cargo_bin("pineappl") .unwrap() .args(["read", "--bins", "../test-data/LHCB_WP_7TEV.pineappl.lz4"]) .assert() .success() .stdout(BINS_STR); } #[test] fn channels() { Command::cargo_bin("pineappl") .unwrap() .args([ "read", "--channels", "../test-data/LHCB_WP_7TEV.pineappl.lz4", ]) .assert() .success() .stdout(CHANNELS_STR); } #[test] fn orders() { Command::cargo_bin("pineappl") .unwrap() .args(["read", "--orders", "../test-data/LHCB_WP_7TEV.pineappl.lz4"]) .assert() .success() .stdout(ORDERS_STR); } #[test] fn orders_long() { Command::cargo_bin("pineappl") .unwrap() .args([ "read", "--orders-long", "../test-data/LHCB_WP_7TEV.pineappl.lz4", ]) .assert() .success() .stdout(ORDERS_LONG_STR); } #[test] fn orders_spaces() { Command::cargo_bin("pineappl") .unwrap() .args([ "read", "--orders-spaces", "../test-data/LHCB_WP_7TEV.pineappl.lz4", ]) .assert() .success() .stdout(ORDERS_SPACES_STR); } #[test] fn fktable() { Command::cargo_bin("pineappl") .unwrap() .args([ "read", "--fktable", "../test-data/LHCB_WP_7TEV.pineappl.lz4", ]) .assert() .failure() .stdout(FKTABLE_STR); } #[test] fn wrong_orders() { Command::cargo_bin("pineappl") .unwrap() .args([ "read", "--orders", "--orders-long", "../test-data/LHCB_WP_7TEV.pineappl.lz4", ]) .assert() .failure() .stderr(WRONG_ORDERS_STR); } #[test] fn ew() { Command::cargo_bin("pineappl") .unwrap() .args(["read", "--ew", "../test-data/LHCB_WP_7TEV.pineappl.lz4"]) .assert() .success() .stdout("a2,a3\n"); } #[test] fn get_arxiv() { Command::cargo_bin("pineappl") .unwrap() .args([ "read", "--get=arxiv", "../test-data/LHCB_WP_7TEV.pineappl.lz4", ]) .assert() .success() .stdout("1505.07024\n"); } #[test] fn keys() { Command::cargo_bin("pineappl") .unwrap() .args(["read", "--keys", "../test-data/LHCB_WP_7TEV.pineappl.lz4"]) .assert() .success() .stdout(KEYS_STR); } #[test] fn qcd() { Command::cargo_bin("pineappl") .unwrap() .args(["read", "--qcd", "../test-data/LHCB_WP_7TEV.pineappl.lz4"]) .assert() .success() .stdout("a2,as1a2\n"); } #[test] fn show() { Command::cargo_bin("pineappl") .unwrap() .args(["read", "--show", "../test-data/LHCB_WP_7TEV.pineappl.lz4"]) .assert() .success() .stdout(SHOW_STR); } #[test] fn wrong_arguments() { Command::cargo_bin("pineappl") .unwrap() .args([ "read", "--ew", "--qcd", "../test-data/LHCB_WP_7TEV.pineappl.lz4", ]) .assert() .failure() .stderr(WRONG_ARGUMENTS_STR); }