Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-25 02:29:03

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