ATLAS Offline Software
readTier0LARNOISE.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 TAG outputs of Tier0 monitoring,
5 # open them and chain them in a single TChain
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 # Author : Benjamin Trocme / Summer 2012
13 
14 import os, sys
15 import argparse
16 
17 from DataQualityUtils import pathExtract
18 from six.moves import xmlrpc_client as xmlrpclib
19 
20 from ROOT import TChain
21 from ROOT import gStyle
22 
23 gStyle.SetPalette(1)
24 gStyle.SetOptStat("em")
25 
26 
27 # Main===========================================================================================================
28 parser = argparse.ArgumentParser()
29 parser.add_argument('-r','--run',type=int,dest='runNumber',default='267599',help="Run number",action='store')
30 parser.add_argument('-s','--stream',dest='stream',default='express',help="Stream without prefix: express, CosmicCalo, Egamma...",action='store')
31 parser.add_argument('-t','--tag',dest='tag',default='',help="DAQ tag: data12_8TeV, data12_calocomm...By default retrieve it via atlasdqm",action='store')
32 parser.add_argument('-a','--amiTag',dest='amiTag',default='x',help="First letter of AMI tag: x->express / f->bulk",action='store')
33 
34 parser.print_help()
35 
36 args = parser.parse_args()
37 
38 runNumber = args.runNumber
39 stream = args.stream
40 if args.tag != "":
41  tag = args.tag
42 else: # Try to retrieve the data project tag via atlasdqm
43  if (not os.path.isfile("atlasdqmpass.txt")):
44  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)")
45  print("To generate a kay, go here : https://atlasdqm.cern.ch/dqauth/")
46  print("You can also define by hand the data project tag wit hthe option -t")
47  sys.exit()
48  passfile = open("atlasdqmpass.txt")
49  passwd = passfile.read().strip(); passfile.close()
50  passurl = 'https://%s@atlasdqm.cern.ch'%passwd
51  s = xmlrpclib.ServerProxy(passurl)
52  run_spec = {'stream': 'physics_CosmicCalo', 'proc_ver': 1,'source': 'tier0', 'low_run': runNumber, 'high_run':runNumber}
53  run_info= s.get_run_information(run_spec)
54  if '%d'%runNumber not in run_info.keys() or len(run_info['%d'%runNumber])<2:
55  print("Unable to retrieve the data project tag via atlasdqm... Please double check your atlasdqmpass.txt or define it by hand with -t option")
56  sys.exit()
57  tag = run_info['%d'%runNumber][1]
58 
59 amiTag = args.amiTag
60 
61 listOfFiles = pathExtract.returnEosLArNoisePath(runNumber,stream,amiTag,tag)
62 
63 tree = TChain("CollectionTree")
64 
65 print(listOfFiles)
66 for fileNames in listOfFiles:
67  print("Adding %s"%(fileNames))
68  tree.AddFile("root://eosatlas/%s"%(fileNames))
69 
70 entries = tree.GetEntries()
71 if entries != 0:
72  print("The chained tree contains %d entries"%(entries))
73 else:
74  print("Empty chain...")
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
Trk::open
@ open
Definition: BinningType.h:40