Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:36

0001 #!/usr/bin/env python3
0002 
0003 from __future__ import print_function
0004 from builtins import range
0005 import os
0006 import subprocess
0007 import argparse
0008 import Alignment.MillePedeAlignmentAlgorithm.mpslib.Mpslibclass as mpslib
0009 
0010 # setup argument parser 
0011 parser = argparse.ArgumentParser(description='Merge millePedeMonitor-root-files from eos, that are from the same dataset.', 
0012                                  formatter_class=argparse.RawDescriptionHelpFormatter)
0013 # positional argument: config file
0014 parser.add_argument('eosDir', 
0015                     action='store', 
0016                     help = 'path of the eos directory')
0017 # parse argument
0018 args = parser.parse_args()
0019 eosDir = args.eosDir
0020 
0021 # read mps.db
0022 lib = mpslib.jobdatabase()
0023 lib.read_db()
0024 for i in range(lib.nJobs):
0025     print(lib.JOBSP3[i])
0026 
0027 # count how much jobs there are of each dataset
0028 occurences = []
0029 items      = []
0030 for i in range(lib.nJobs):
0031     if lib.JOBSP3[i] not in items:
0032         items.append(lib.JOBSP3[i])
0033 
0034 for i in range(len(items)):
0035     occurences.append(lib.JOBSP3.count(items[i]))
0036 
0037 # copy files from eos and combine root-files of each dataset with "hadd"
0038 counter = 0
0039 for i in range(len(items)):
0040     command  = 'hadd '
0041     command += 'monitormerge_'+items[i]+'.root '    
0042     for j in range(occurences[i]):
0043         os.system('cp '+eosDir+'/millePedeMonitor%03d.root .' % (counter+j+1))
0044         command += 'millePedeMonitor%03d.root ' % (counter+j+1) 
0045     os.system(command)
0046     for j in range(occurences[i]):
0047         os.system('rm millePedeMonitor%03d.root' % (counter+j+1))
0048     counter += occurences[i]
0049 
0050 
0051 
0052 
0053 
0054 
0055 
0056 
0057 
0058 
0059 
0060 
0061 
0062 
0063