ATLAS Offline Software
Loading...
Searching...
No Matches
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
14import os, sys
15import argparse
16
17from DataQualityUtils import pathExtract
18from xmlrpc import client as xmlrpclib
19
20from ROOT import TChain
21from ROOT import gStyle
22
23gStyle.SetPalette(1)
24gStyle.SetOptStat("em")
25
26
27# Main===========================================================================================================
28parser = argparse.ArgumentParser()
29parser.add_argument('-r','--run',type=int,dest='runNumber',default='267599',help="Run number",action='store')
30parser.add_argument('-s','--stream',dest='stream',default='express',help="Stream without prefix: express, CosmicCalo, Egamma...",action='store')
31parser.add_argument('-t','--tag',dest='tag',default='',help="DAQ tag: data12_8TeV, data12_calocomm...By default retrieve it via atlasdqm",action='store')
32parser.add_argument('-a','--amiTag',dest='amiTag',default='x',help="First letter of AMI tag: x->express / f->bulk",action='store')
33
34parser.print_help()
35
36args = parser.parse_args()
37
38runNumber = args.runNumber
39stream = args.stream
40if args.tag != "":
41 tag = args.tag
42else: # 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
59amiTag = args.amiTag
60
61listOfFiles = pathExtract.returnEosLArNoisePath(runNumber,stream,amiTag,tag)
62
63tree = TChain("CollectionTree")
64
65print(listOfFiles)
66for fileNames in listOfFiles:
67 print("Adding %s"%(fileNames))
68 tree.AddFile("root://eosatlas/%s"%(fileNames))
69
70entries = tree.GetEntries()
71if entries != 0:
72 print("The chained tree contains %d entries"%(entries))
73else:
74 print("Empty chain...")
void print(char *figname, TCanvas *c1)