Functions | Variables
validateGRLvsSAM Namespace Reference

Functions

def validate (grl, sam_def, sam_runs, nd=False, dq=True, verbose=False)
 functions More...
 

Variables

 sam = samweb_client.SAMWebClient(experiment="nova")
 
list study = ["fd","nd","nd_stagger"]
 options More...
 
string fd_grl = "/nova/app/users/rbpatter/runlists/fd_numi_subrunlist_20150320_30secadded.vec"
 Run FD. More...
 
string fd_sam_def = "prod_artdaq_S15-03-11_fd_numi"
 
string fd_sam_runs = "FD_data_epoch_A_runs"
 
string nd_grl = "/nova/app/users/rbpatter/runlists/nd_numi_subrunlist_20150318_30secadded.vec"
 ND. More...
 
string nd_sam_def = "prod_artdaq_S15-03-11_nd_numi"
 
string nd_sam_runs = "ND_data_epoch_A_runs"
 
 nd
 

Function Documentation

def validateGRLvsSAM.validate (   grl,
  sam_def,
  sam_runs,
  nd = False,
  dq = True,
  verbose = False 
)

functions

Definition at line 10 of file validateGRLvsSAM.py.

References makeTrainCVSamples.int, and open().

10 def validate(grl,sam_def,sam_runs,nd=False,dq=True,verbose=False):
11  sam_query = "defname: %s and defname: %s"%(sam_def,sam_runs)
12  if dq: sam_query += " and dq.isgoodrun true"
13  sam_files = sam.listFiles(dimensions=sam_query)
14  print "run : Query: %s returned %i files"%(sam_query,len(sam_files))
15 
16  in_sam = {}
17  for sam_file in sam_files:
18  run = tools.findRun(sam_file)
19  subrun = tools.findSubRun(sam_file)
20  if run not in in_sam.keys(): in_sam[run] = []
21  in_sam[run].append(subrun)
22 
23  in_grl = {}
24  n_files = 0
25  for line in open(grl,"r").readlines():
26  run = int(line.split()[0])
27  subrun = int(line.split()[1])
28  if run not in in_grl.keys(): in_grl[run] = []
29  in_grl[run].append(subrun)
30  n_files +=1
31  print "run : GRL: %s contains %i files"%(grl,n_files)
32 
33  print "run : --- Checking for GRL in SAM"
34  grl_errors = 0
35  zero_events = 0
36  grl_keys = in_grl.keys()
37  grl_keys.sort()
38  for grl_run in grl_keys:
39  for grl_sub_run in in_grl[grl_run]:
40  if (grl_run not in in_sam.keys()) or \
41  (grl_sub_run not in in_sam[grl_run]):
42  # these can be dropped due to metadata problems
43  if nd:
44  raw_name = "neardet_r%08d_s%02d_t00.raw"%(grl_run,grl_sub_run)
45  else:
46  raw_name = "fardet_r%08d_s%02d_t00.raw"%(grl_run,grl_sub_run)
47  if verbose: print "run : checking metadata, using name: %s"%raw_name
48  metadata = sam.getMetadata(raw_name)
49  if verbose: print "run : total events: %i"%metadata["Online.TotalEvents"]
50  if metadata["Online.TotalEvents"] == 0:
51  if verbose: print "run : - 0 online total events"
52  zero_events+=1
53  continue
54  grl_errors+= 1
55  print "run : Error [%i] Run %i, subrun %i in GRL but not in SAM"%(grl_errors, grl_run,grl_sub_run)
56  print "run : --- Found %i error files and %i files with zero events"%(grl_errors,zero_events)
57 
58  print "run : --- Checking for SAM in GRL"
59  sam_errors = 0
60  sam_keys = in_sam.keys()
61  sam_keys.sort()
62  for sam_run in sam_keys:
63  for sam_sub_run in in_sam[sam_run]:
64  if (sam_run not in in_grl.keys()) or \
65  (sam_sub_run not in in_grl[sam_run]):
66  sam_errors += 1
67  print "run : Error [%i] Run %i, subrun %i in SAM but not in GRL"%(sam_errors,sam_run,sam_sub_run)
68  print "run : --- Found %i error files"%sam_errors
def validate(grl, sam_def, sam_runs, nd=False, dq=True, verbose=False)
functions
procfile open("FD_BRL_v0.txt")

Variable Documentation

string validateGRLvsSAM.fd_grl = "/nova/app/users/rbpatter/runlists/fd_numi_subrunlist_20150320_30secadded.vec"

Run FD.

Definition at line 73 of file validateGRLvsSAM.py.

string validateGRLvsSAM.fd_sam_def = "prod_artdaq_S15-03-11_fd_numi"

Definition at line 74 of file validateGRLvsSAM.py.

string validateGRLvsSAM.fd_sam_runs = "FD_data_epoch_A_runs"

Definition at line 75 of file validateGRLvsSAM.py.

validateGRLvsSAM.nd

Definition at line 83 of file validateGRLvsSAM.py.

string validateGRLvsSAM.nd_grl = "/nova/app/users/rbpatter/runlists/nd_numi_subrunlist_20150318_30secadded.vec"

ND.

ND stagger.

Definition at line 80 of file validateGRLvsSAM.py.

string validateGRLvsSAM.nd_sam_def = "prod_artdaq_S15-03-11_nd_numi"

Definition at line 81 of file validateGRLvsSAM.py.

string validateGRLvsSAM.nd_sam_runs = "ND_data_epoch_A_runs"

Definition at line 82 of file validateGRLvsSAM.py.

validateGRLvsSAM.sam = samweb_client.SAMWebClient(experiment="nova")

Definition at line 4 of file validateGRLvsSAM.py.

list validateGRLvsSAM.study = ["fd","nd","nd_stagger"]

options

Definition at line 7 of file validateGRLvsSAM.py.