ATLAS Offline Software
Loading...
Searching...
No Matches
readTier0HIST.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# Simple script to extract the path of the HIST output of Tier0 monitoring,
5# open it and open a TBrowser
6# Uses the pathExtract library to extract the EOS path
7# Options:
8# -r RUNNUMBER, --run RUNNUMBER : Run number
9# -s STREAM, --stream STREAM : Stream without prefix: express, CosmicCalo, Egamma...
10# -t TAG, --tag TAG : DAQ tag: data12_8TeV, data12_calocomm...
11# -a AMITAG, --amiTag AMITAG : First letter of AMI tag: x->express / f->bulk
12#
13# Author : Benjamin Trocme (LPSC Grenoble) / Summer 2012, updated in 2015
14
15
16
17import os, sys
18import argparse
19from xmlrpc import client as xmlrpclib
20
21from DataQualityUtils import pathExtract
22
23from ROOT import TFile,TBrowser
24from ROOT import gStyle
25
26# Main ================================================================
27gStyle.SetPalette(1)
28gStyle.SetOptStat("emuo")
29
30parser = argparse.ArgumentParser()
31parser.add_argument('-r','--run',type=int,dest='runNumber',default='267599',help="Run number",action='store')
32parser.add_argument('-s','--stream',dest='stream',default='express',help="Stream without prefix: express, CosmicCalo, Egamma...",action='store')
33parser.add_argument('-t','--tag',dest='tag',default='',help="DAQ tag: data12_8TeV, data12_calocomm...By default retrieve it via atlasdqm",action='store')
34parser.add_argument('-a','--amiTag',dest='amiTag',default='x',help="First letter of AMI tag: x->express / f->bulk",action='store')
35parser.add_argument('-l','--lumiblock',type=int,dest='lumiblock',default='0',help="if none empty, try to get unmerged HIST files for a specific LB",action='store')
36
37parser.print_help()
38
39args = parser.parse_args()
40
41runNumber = args.runNumber
42LB = args.lumiblock
43stream = args.stream
44if args.tag != "":
45 tag = args.tag
46else: # Try to retrieve the data project tag via atlasdqm
47 if (not os.path.isfile("atlasdqmpass.txt")):
48 print("To retrieve the data project tag, you need to generate an atlasdqm key and store it in this directory as atlasdqmpass.txt (yourname:key)")
49 print("To generate a kay, go here : https://atlasdqm.cern.ch/dqauth/")
50 print("You can also define by hand the data project tag wit hthe option -t")
51 sys.exit()
52 passfile = open("atlasdqmpass.txt")
53 passwd = passfile.read().strip(); passfile.close()
54 passurl = 'https://%s@atlasdqm.cern.ch'%passwd
55 s = xmlrpclib.ServerProxy(passurl)
56 run_spec = {'stream': 'physics_CosmicCalo', 'proc_ver': 1,'source': 'tier0', 'low_run': runNumber, 'high_run':runNumber}
57 run_info= s.get_run_information(run_spec)
58 if '%d'%runNumber not in run_info.keys() or len(run_info['%d'%runNumber])<2:
59 print("Unable to retrieve the data project tag via atlasdqm... Please double check your atlasdqmpass.txt or define it by hand with -t option")
60 sys.exit()
61 tag = run_info['%d'%runNumber][1]
62
63amiTag = args.amiTag
64
65
66path = []
67
68if args.lumiblock == 0:
69 path.append("root://eosatlas.cern.ch/%s"%(pathExtract.returnEosHistPath(args.runNumber,args.stream,args.amiTag,tag)).rstrip())
70else:
71 allUnmerged = pathExtract.returnEosHistPathLB(runNumber,LB,LB,stream,amiTag,tag)
72 for iFile in allUnmerged:
73 path.append("root://eosatlas.cern.ch/%s"%(iFile).rstrip())
74# path.add("root://eosatlas.cern.ch/%s"%(.rstrip())
75
76
77file = []
78for iPath in path:
79 if ("NO FILE" not in iPath):
80 print("I am opening %s"%(iPath))
81 file.append( TFile.Open(iPath))
82
83gStyle.SetPalette(1)
84tb = TBrowser()
void print(char *figname, TCanvas *c1)