write_to_db_pdsp.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import ROOT as RT
4 import os, re
5 from glob import glob as ls
6 from argparse import ArgumentParser as ap
7 
8 parser = ap()
9 
10 parser.add_argument( "-p", type=str, help='Path to files', default='./')
11 args = parser.parse_args()
12 
13 #print(ls(args.p))
14 
15 all_files = [i.split("/")[-1] for i in sorted(ls(args.p + "*"))]
16 
17 for p in all_files:
18  if '.csv' in p:
19  print(p)
20  run = "0"
21  data_type = "mc"
22  command = "print"
23  if 'globalmedians' in p:
24  run = p[p.find("run")+3:p.find(".csv")]
25  print (run)
26  if run != "0":
27  data_type = "data"
28  command = "python $CONDB_DIR/bin/write_data.py -h ifdbprod2.fnal.gov -p 5451 -U tjyang -c {} -d {} pdunesp_prod pdunesp.distcorrnorm norm,norm_err".format(p, data_type)
29  else:
30  pattern = "\_(.*?)\_"
31  run = re.search(pattern,p).group(1)
32  print (run)
33  if run != "0":
34  data_type = "data"
35  if 'xcorr' in p:
36  command = "python $CONDB_DIR/bin/write_data.py -h ifdbprod2.fnal.gov -p 5451 -U tjyang -c {} -d {} pdunesp_prod pdunesp.distcorrx x,dx,shape,shape_err".format(p, data_type)
37  elif 'yzcorr' in p:
38  command = "python $CONDB_DIR/bin/write_data.py -h ifdbprod2.fnal.gov -p 5451 -U tjyang -c {} -d {} pdunesp_prod pdunesp.distcorryz y,dy,z,dz,corr,corr_err".format(p, data_type)
39  print (command)
40  os.system(command)
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
Definition: qstring.cpp:11496