ATLAS Offline Software
outputTest_v2.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 
5 from optparse import OptionParser
6 
7 
8 
9 physicsStreams = ["physics_Main","physics_MinBias","physics_MinBiasOverlay","physics_ZeroBias","physics_HardProbes",
10  "physics_TauOverlay","physics_CosmicCalo", "physics_CosmicMuons","physics_IDCosmic",
11  "physics_HLT_IDCosmic","physics_Standby","physics_Late","physics_L1Calo","physics_L1Topo",
12  "express_express"]
13 
14 
15 monitoringStreams = ["calibration_Background","calibration_beamspot","calibration_IBLLumi","calibration_PixelBeam",
16  "caibration_vdM", "calibration_PIxelNoise", "calibration_SCTNoise", "calibration_IDTracks",
17  "calibration_LArCells","calibration_LArCellsEmpty","calibration_LArNoiseBurst","calibration_Tile"
18  "calibration_MuonAll","calibration_CostMonitoring"]
19 
20 otherStream = ["calibration_IDFwd","calibration_ALFA","calibration_DataScoutingXX","debugrec_hltacc","debugrec_hltrej","debugrec_crashed"]
21 
22 def readJson(filename):
23  s = open(filename, 'r').read()
24  outputs = eval(s)
25  #print (outputs)
26  return outputs
27 
28 import re
29 
30 #Dictionary
31 
32 def_outputs = {'outputDESDM_CALJETFile': {'dstype': 'DESDM_CALJET', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_Main.*)'}, 'outputESDFile': {'dstype': '!replace RAW ESD', 'ifMatch': '(?!.*DRAW.*)(?!.*physics_Main.*)'}, 'outputDESDM_SGLELFile': {'dstype': 'DESDM_SGLEL', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_Main.*)'}, 'outputDESDM_SLTTMUFile': {'dstype': 'DESDM_SLTTMU', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_Main.*)'}, 'outputDESDM_RPVLLFile': {'dstype': 'DESDM_RPVLL', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_Main.*)'}, 'outputDAOD_IDTRKVALIDFile': {'dstype': 'DAOD_IDTRKVALID', 'ifMatch': 'data[0-9][0-9]_(cos|1beam|.*eV|comm)(?!.*DRAW.*)(.*MinBias.*|.*IDCosmic.*)'}, 'outputDRAW_ZMUMUFile': {'dstype': 'DRAW_ZMUMU', 'ifMatch': 'data[0-9][0-9]_(1beam|.*eV|comm)(?!.*DRAW.*)(.*physics_Main\\..*)'}, 'outputDAOD_IDTIDEFile': {'dstype': 'DAOD_IDTIDE', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_Main.*)'}, 'outputDRAW_TAUMUHFile': {'dstype': 'DRAW_TAUMUH', 'ifMatch': 'data[0-9][0-9]_(1beam|.*eV|comm)(?!.*DRAW.*)(.*physics_Main\\..*)'}, 'outputDESDM_MSPerfFile': {'dstype': '!replace RAW DESDM_MCP DDESDM_MCP_ZMUMU DESDM_ZMCP', 'ifMatch': 'data[0-9][0-9]_(1beam|.*eV|comm)(.*physics_Main\\..*)(.*\\.RAW\\.*|.*DRAW_ZMUMU.*)'}, 'outputDESDM_EGAMMAFile': {'dstype': 'DESDM_EGAMMA', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_Main.*)'}, 'outputDRAW_EMUFile': {'dstype': 'DRAW_EMU', 'ifMatch': 'data[0-9][0-9]_(1beam|.*eV|comm)(?!.*DRAW.*)(.*physics_Main\\..*)'}, 'outputDRAW_EGZFile': {'dstype': 'DRAW_EGZ', 'ifMatch': 'data[0-9][0-9]_(1beam|.*eV|comm)(?!.*DRAW.*)(.*physics_Main\\..*)'}, 'outputDESDM_PHOJETFile': {'dstype': 'DESDM_PHOJET', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_Main.*)'}, 'outputAODFile': {'dstype': '!replace RAW AOD', 'ifMatch': 'data[0-9][0-9]_(cos|1beam|.*eV|comm)'}, 'outputDESDM_EOVERPFile': {'dstype': 'DESDM_EOVERP', 'ifMatch': 'data[0-9][0-9]_.*eV(?!.*DRAW.*)(.*physics_MinBias.*)'}, 'outputDESDM_ALLCELLSFile': {'dstype': '!replace RAW ESDM', 'ifMatch': 'data[0-9][0-9]_(1beam|.*eV|comm)(?!.*DRAW_TAUMUH.*)(.*DRAW.*)'}, 'outputHISTFile': {'dstype': 'HIST', 'ifMatch': '(?!.(.*DRAW.*|.*debugrec.*))'}}
33 
34 
35 
36 parser=OptionParser(usage="\n ./outputTest_v2 -s allStreams [-f <filename of file containing output dict>] \n")
37 parser.add_option("-s","--streams" ,type="string" ,dest="streams" ,default="physics_Main,express_express" ,help="comma seperated list of streams")
38 parser.add_option("-p","--project" ,type="string" ,dest="project" ,default="data15_13TeV" ,help="projects")
39 parser.add_option("-r","--runnumber" ,type="string" ,dest="runnumber" ,default="00267639" ,help="run number")
40 parser.add_option("-f","--filename" ,type="string" ,dest="filename" ,default="default_outputs.dict" ,help="run number")
41 
42 (options,args)=parser.parse_args()
43 
44 
45 if options.filename:
46  try:
47  outputs = readJson(options.filename)
48  except Exception:
49  print()
50  print ("WARNING: file with dict %s not available... using default outputs dict" %(options.filename))
51  print()
52 else:
53  outputs = def_outputs
54 
55 streams = []
56 project = options.project
57 runnumber = options.runnumber
58 inStreams = options.streams.split(",")
59 
60 """"
61  define list of streams
62 """
63 if "physicsStreams" in inStreams:
64  streams.extend(physicsStreams)
65  inStreams.remove("physicsStreams")
66 if "monitoringStreams" in inStreams:
67  streams.extend(monitoringStreams)
68  inStreams.remove("monitoringStreams")
69 if "otherStreams" in inStreams:
70  streams.extend(monitoringStreams)
71  inStreams.remove("otherStreams")
72 
73 if "allStreams" in inStreams:
74  streams.extend(physicsStreams)
75  streams.extend(monitoringStreams)
76  streams.extend(monitoringStreams)
77  inStreams.remove("allStreams")
78 
79 
80 
81 if inStreams:
82  for stream in inStreams:
83  if stream in physicsStreams or stream in monitoringStreams or stream in otherStream:
84  streams.append(stream)
85  else:
86  print ("WARNING: %s is not defined in known stream" %(stream))
87 
88 
89 
90 """
91  print (output types per stream)
92 """
93 for stream in streams:
94  inputds = project+"."+runnumber+"."+stream+".merge.RAW"
95  print ("Primary outputs %s RAW \n" %(stream))
96  print ("\t inputDS: %s \n" %(inputds) )
97  for k in outputs.keys() :
98  if re.match(outputs[k]['ifMatch'], inputds) :
99  print ("- %s" %(k))
100  print ()
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
Trk::open
@ open
Definition: BinningType.h:40
python.outputTest_v2.readJson
def readJson(filename)
Definition: outputTest_v2.py:22
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70