19 from six.moves
import xmlrpc_client
as xmlrpclib
21 from DataQualityUtils
import pathExtract
23 from ROOT
import TFile,TBrowser
24 from ROOT
import gStyle
28 gStyle.SetOptStat(
"emuo")
30 parser = argparse.ArgumentParser()
31 parser.add_argument(
'-r',
'--run',type=int,dest=
'runNumber',default=
'267599',help=
"Run number",action=
'store')
32 parser.add_argument(
'-s',
'--stream',dest=
'stream',default=
'express',help=
"Stream without prefix: express, CosmicCalo, Egamma...",action=
'store')
33 parser.add_argument(
'-t',
'--tag',dest=
'tag',default=
'',help=
"DAQ tag: data12_8TeV, data12_calocomm...By default retrieve it via atlasdqm",action=
'store')
34 parser.add_argument(
'-a',
'--amiTag',dest=
'amiTag',default=
'x',help=
"First letter of AMI tag: x->express / f->bulk",action=
'store')
35 parser.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')
39 args = parser.parse_args()
41 runNumber = args.runNumber
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")
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")
61 tag = run_info[
'%d'%runNumber][1]
68 if args.lumiblock == 0:
69 path.append(
"root://eosatlas.cern.ch/%s"%(pathExtract.returnEosHistPath(args.runNumber,args.stream,args.amiTag,tag)).rstrip())
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())
79 if (
"NO FILE" not in iPath):
80 print(
"I am opening %s"%(iPath))
81 file.append( TFile.Open(iPath))