ATLAS Offline Software
DQWebDisplay.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 
6 from __future__ import print_function
7 
8 import os
9 
10 import logging
11 logging.basicConfig(level=logging.INFO)
12 
13 
14 CWD = os.getcwd()
15 os.chdir(CWD)
16 
17 
18 os.environ['TDAQ_ERS_NO_SIGNAL_HANDLERS'] = '1'
19 
20 import sys
21 sys.argv.append( '-b-' )
22 import ROOT
23 
26 from ROOT import gSystem # noqa: F401
27 os.chdir(CWD)
28 
29 from DataQualityUtils.DQWebDisplayMod import DQWebDisplay
30 
31 def importConfiguration(modname):
32  from DataQualityConfigurations import getmodule
33  print('getting configuration', modname)
34  return getmodule(modname)
35 
36 def usage():
37  cmdi = sys.argv[0].rfind("/")
38  cmd = sys.argv[0][cmdi+1:]
39  print("")
40  print("Usage: ", cmd, "<data_file> <config> <processing_version> [run_accumulating [conditions_string]]")
41  print("")
42  print("This is a production utility; use TEST config for development and testing.")
43  print("")
44  print("Processing version is an integer, starting from 1 (not 0)")
45  print("")
46 
47 if __name__ == "__main__":
48  print(len(sys.argv))
49  if len(sys.argv) < 5 or len(sys.argv) > 7:
50  usage()
51  sys.exit(64)
52 
53  inputFile = sys.argv[1] # data file
54  runAccumulating = False
55  if len(sys.argv) in (6,7):
56  if sys.argv[4] == "True" or sys.argv[4] == "1":
57  runAccumulating = True
58 
59  if len(sys.argv) == 7:
60  print('Setting condition', sys.argv[5])
61  ROOT.gSystem.Load('libDataQualityInterfaces')
62  ROOT.dqi.ConditionsSingleton.getInstance().setCondition(sys.argv[5])
63 
64  configModule = ""
65 
66  if sys.argv[2] == "TEST":
67  configModule = "TestDisplay"
68  elif sys.argv[2] == "RTT":
69  configModule = "RTTDisplay"
70  elif sys.argv[2] == "TCT":
71  configModule = "TCTDisplay"
72  elif sys.argv[2] == "FDR1":
73  configModule = "fdr08_run1"
74  elif sys.argv[2] == "FDR2" or sys.argv[2] == "FDR2a" or sys.argv[2] == "FDR2b" or sys.argv[2] == "FDR2c":
75  configModule = "fdr08_run2"
76  elif sys.argv[2] == "Cosmics08":
77  configModule = "data08_cos"
78  elif sys.argv[2] == "SingleBeam08":
79  configModule = "data08_1beam"
80  else:
81  configModule = sys.argv[2]
82 
83  try:
84  cmod = importConfiguration(configModule)
85  except Exception as e:
86  print("Could not import configuration module \'" + configModule + "\'")
87  sys.exit(1)
88 
89  try:
90  config = cmod.dqconfig
91  except Exception as e:
92  print("Configuration object 'dqconfig' not defined in module \'" + configModule + "\'")
93  sys.exit(1)
94 
95 
96  DQWebDisplay( inputFile, runAccumulating, config )
DQWebDisplay.importConfiguration
def importConfiguration(modname)
Definition: DQWebDisplay.py:31
python.DQCDispatch.getmodule
def getmodule(modname)
Definition: DQCDispatch.py:10
DQWebDisplay
Definition: DQWebDisplay.py:1
DQWebDisplay.usage
def usage()
Definition: DQWebDisplay.py:36
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70