File indexing completed on 2024-11-25 02:29:10
0001
0002
0003 import os,sys
0004 import getopt
0005 import time
0006 import ROOT
0007 import urllib
0008 import string
0009 import optparse
0010 import dataCert
0011
0012
0013
0014 usage = 'usage: %prog [options]'
0015 parser = optparse.OptionParser(usage)
0016 parser.add_option('-f', '--firstRun' , dest='firstRun' , help='first run to process (-1 --> automatic)' , default='-1')
0017 parser.add_option('-l', '--lastRun' , dest='lastRun' , help='last run to process (-1 --> automatic)' , default='-1')
0018 parser.add_option('-P', '--publish' , dest='publish' , help='publish the results' , default='True')
0019 parser.add_option('-p', '--pcl' , dest='usePCL' , help='use PCL output instead of calibTree' , default='True')
0020 parser.add_option('-m', '--mode' , dest='calMode' , help='select the statistics type' , default='AagBunch')
0021 parser.add_option('-s', '--scriptDir' , dest='scriptDir' , help='select the scriptDirectory' , default='')
0022 parser.add_option('-a', '--automatic' , dest='automatic' , help='set if ran automaticaly' , default='')
0023 (opt, args) = parser.parse_args()
0024
0025 scriptDir = os.getcwd()
0026 firstRun = int(opt.firstRun)
0027 lastRun = int(opt.lastRun)
0028
0029 calMode = str(opt.calMode) if not str(opt.calMode)=='' else "AagBunch"
0030 MC=""
0031 publish = (opt.publish=='True')
0032 mail = "martin.delcourt@cern.ch "
0033
0034 usePCL = (opt.usePCL=='True')
0035
0036 initEnv='cd ' + os.getcwd() + ';'
0037 initEnv+='source /afs/cern.ch/cms/cmsset_default.sh' + ';'
0038 initEnv+='eval `scramv1 runtime -sh`' + ';'
0039
0040 name = "Run_"+str(firstRun)+"_to_"+str(lastRun)
0041 if len(calMode)>0: name = name+"_"+calMode
0042 if(usePCL==True): name = name+"_PCL"
0043 else: name = name+"_CalibTree"
0044 print(name)
0045
0046 automatic = opt.automatic
0047 scriptDir = opt.scriptDir
0048
0049
0050 if(os.system(initEnv+"sh sequence.sh \"" + name + "\" \"" + calMode + "\" \"CMS Preliminary - Run " + str(firstRun) + " to " + str(lastRun) + "\"")!=0):
0051 os.system('echo "Gain calibration failed" | mail -s "Gain calibration failed ('+name+')" ' + mail)
0052 else:
0053 if(publish==True):os.system(initEnv+"sh sequence.sh " + name);
0054 os.system('echo "Manual gain calibration done\nhttps://test-stripcalibvalidation.web.cern.ch/test-stripcalibvalidation/CalibrationValidation/ParticleGain/" | mail -s "Gain calibration done ('+name+')" ' + mail)
0055
0056 if(automatic==True):
0057
0058 os.chdir(scriptDir);
0059 os.system('python automatic_RunOnCalibTree.py')