|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +import sys |
| 4 | +import os |
| 5 | +from subprocess import call |
| 6 | + |
| 7 | +################################# |
| 8 | +# Setup Parameters for iterations |
| 9 | +################################# |
| 10 | + |
| 11 | +nIterations=10 |
| 12 | +filename='/raid12/gluex/RunPeriod-2017-01/rawdata/Run030778/hd_rawdata_030778_000.evio' |
| 13 | +nThreads=4 |
| 14 | +nEvents=1000000 |
| 15 | + |
| 16 | +############################################# |
| 17 | +# You shouldn't have to edit below this lines |
| 18 | +############################################# |
| 19 | + |
| 20 | +ccdb_connection = os.environ['CCDB_CONNECTION'] |
| 21 | + |
| 22 | +if 'mysql' in ccdb_connection: |
| 23 | + print "CONNECTED TO JLAB MYSQL DATABASE === ABORTING" |
| 24 | + quit() |
| 25 | + |
| 26 | +if 'sqlite' not in ccdb_connection: |
| 27 | + print "UNKNOWN DATABASE TYPE %s == MUST USE SQLITE" % ccdb_connection |
| 28 | + quit() |
| 29 | + |
| 30 | +try: |
| 31 | + os.mkdir('FDCInternalAlignIterations'); |
| 32 | +except OSError: |
| 33 | + pass |
| 34 | + |
| 35 | +for iter in range(1,nIterations): |
| 36 | + print "Iteration %.2i of %.2i" % (iter, nIterations) |
| 37 | + call('hd_root -PPLUGINS=FDC_InternalAlignment %s -PNTHREADS=%i -PEVENTS_TO_KEEP=%i' % (filename, nThreads, nEvents), shell=True) |
| 38 | + call(r'root -l -b -q $HALLD_HOME/src/plugins/Alignment/FDC_InternalAlignment/FitScripts/FitCathodeAlignment.C\(\"hd_root.root\"\)',shell=True) |
| 39 | + call('mv Result.png FDCInternalAlignIterations/Result_Iter%.2i.png' % iter, shell=True) |
| 40 | + call('mv Result.png FDCInternalAlignIterations/hd_root_Planes_Iter%.2i.png' % iter, shell=True) |
| 41 | + call('ccdb add /FDC/cathode_alignment CathodeAlignment.txt', shell=True) |
| 42 | + call('hd_root -PPLUGINS=FDC_InternalAlignment %s -PNTHREADS=%i -PEVENTS_TO_KEEP=%i' % (filename, nThreads, nEvents), shell=True) |
| 43 | + call(r'root -l -b -q $HALLD_HOME/src/plugins/Alignment/FDC_InternalAlignment/FitScripts/FitCathodeProjections.C\(\"hd_root.root\"\)',shell=True) |
| 44 | + call('ccdb add /FDC/cathode_alignment CathodeAlignment.txt', shell=True) |
| 45 | + call('ccdb add /FDC/strip_pitches_v2 StripPitchesV2.txt',shell=True) |
| 46 | + call('mv Result.png FDCInternalAlignIterations/hd_root_Projections_Iter%.2i.png' % iter, shell=True) |
| 47 | + call('mv ResultU.png FDCInternalAlignIterations/ResultU_Iter%.2i.png' % iter, shell=True) |
| 48 | + call('mv ResultV.png FDCInternalAlignIterations/ResultV_Iter%.2i.png' % iter, shell=True) |
| 49 | + |
| 50 | +print "======= FINAL ITERATION =======" |
| 51 | +call('hd_root -PPLUGINS=FDC_InternalAlignment %s -PNTHREADS=%i -PEVENTS_TO_KEEP=%i' % (filename, nThreads, nEvents), shell=True) |
| 52 | +call(r'root -l -b -q $HALLD_HOME/src/plugins/Alignment/FDC_InternalAlignment/FitScripts/FitCathodeAlignment.C\(\"hd_root.root\"\)',shell=True) |
| 53 | +call('ccdb add /FDC/cathode_alignment CathodeAlignment.txt', shell=True) |
| 54 | +call('mv Result.png FDCInternalAlignIterations/Result_Iter%.2i.png' % nIterations, shell=True) |
| 55 | +call(r'root -l -b -q $HALLD_HOME/src/plugins/Alignment/FDC_InternalAlignment/FitScripts/FitCathodeProjections.C\(\"hd_root.root\"\)',shell=True) |
| 56 | +call('mv ResultU.png FDCInternalAlignIterations/ResultU_Iter%.2i.png' % nIterations, shell=True) |
| 57 | +call('mv ResultV.png FDCInternalAlignIterations/ResultV_Iter%.2i.png' % nIterations, shell=True) |
| 58 | + |
| 59 | + |
0 commit comments