ATLAS Offline Software
readFiles.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2 
3 # file to parse log files for rate compilation
4 # instructions can be found in compileRPVLLRates.py
5 # receives two arguments: output file + input directory containing log files to be parsed
6 
7 from os import listdir
8 from os.path import isfile, join
9 import re
10 import sys
11 
12 text_file = open(sys.argv[1], "w")
13 mypath = sys.argv[2]
14 # get list of log files w/in directory passed as argument
15 onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
16 
17 print('About to loop through files!')
18 for f in onlyfiles:
19  badName = False
20  #sometimes ls files from mounted eos gives funny results. This should fix that!
21  #double check that any files that had "sys" in the name are not duplicates of files without - in some runs, they all are! there should only be a handful.
22  #if they're all duplicates, can just skip files with 'sys' in f instead.
23  if 'sys' in f:
24  badName = True
25  openFile = open(mypath+'.'.join(f.split('.')[3:16]))
26  else:
27  openFile = open(mypath+f)
28  print(f)
29  for line in openFile:
30  if re.match('RAWtoALL.*RPVLL.*Events',line) or re.match('RAWtoALL.*BSESOutputSvcStreamDRAW_RPVLL.*events',line):
31  if badName:
32  text_file.write('.'.join(f.split('.')[3:16]) + ':' + line)
33  else:
34  text_file.write(f + ':' + line)
35 text_file.close()
python.dummyaccess.listdir
def listdir(dirname)
Definition: dummyaccess.py:6
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition: BinningType.h:40
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28