17 from DataQualityUtils
import pathExtract
18 from six.moves
import xmlrpc_client
as xmlrpclib
20 from ROOT
import TChain
21 from ROOT
import gStyle
24 gStyle.SetOptStat(
"em")
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')
36 args = parser.parse_args()
38 runNumber = args.runNumber
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")
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")
57 tag = run_info[
'%d'%runNumber][1]
61 listOfFiles = pathExtract.returnEosLArNoisePath(runNumber,stream,amiTag,tag)
63 tree = TChain(
"CollectionTree")
66 for fileNames
in listOfFiles:
67 print(
"Adding %s"%(fileNames))
68 tree.AddFile(
"root://eosatlas/%s"%(fileNames))
70 entries = tree.GetEntries()
72 print(
"The chained tree contains %d entries"%(entries))
74 print(
"Empty chain...")