def sbitReadOut(args): """ Launches a call of sbitReadOut.py args - object returned by argparse.ArgumentParser.parse_args() """ startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") # Determine number of OH's cardName = getCardName(args.shelf,args.slot) amcBoard = HwAMC(cardName, args.debug) print('opened connection') for ohN in range(0,amcBoard.nOHs): # Skip masked OH's if( not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf,args.slot,ohN) print("Reading out SBITs from shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) # Get & make the output directory dirPath = makeScanDir(args.slot, ohN, "sbitMonRO", startTime, args.shelf) # Build Command cmd = [ "sbitReadOut.py", "--gemType={}".format(args.gemType), "--detType={}".format(args.detType), "--vfatmask=0x{:x}".format(args.vfatmask if (args.vfatmask is not None) else amcBoard.getLinkVFATMask(ohN) ), str(args.shelf), str(args.slot), str(ohN), str(args.time), dirPath ] # debug flag raised? if args.debug: cmd.insert(1,"--debug") # Additional options if args.amc13local: cmd.insert(1,"--amc13local") if args.fakeTTC: cmd.insert(1,"--fakeTTC") if args.t3trig: cmd.insert(1,"--t3trig") # Execute executeCmd(cmd,dirPath) print("Finished reading out SBITs from shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) print("Finished reading out SBITs from all optohybrids on shelf{0} slot{1} in ohMask: 0x{2:x}".format(args.shelf,args.slot,args.ohMask)) return
def ultraThreshold(args): """ Launches a call of ultraThreshold.py args - object returned by argparse.ArgumentParser.parse_args() """ startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") # Determine number of OH's cardName = getCardName(args.shelf,args.slot) amcBoard = HwAMC(cardName, args.debug) print('opened connection') for ohN in range(0,amcBoard.nOHs): # Skip masked OH's if( not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf,args.slot,ohN) print("Launching CFG_THR_ARM_DAC scan for shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) # Get & make the output directory dirPath = makeScanDir(args.slot, ohN, "thresholdch", startTime, args.shelf) # Build Command cmd = [ "ultraThreshold.py", "--gemType={}".format(args.gemType), "--detType={}".format(args.detType), "--chMax={}".format(args.chMax), "--chMin={}".format(args.chMin), "-f {0}/ThresholdScanData.root".format(dirPath), "-g {}".format(ohN), "--nevts={}".format(args.nevts), "--perchannel", "--shelf={}".format(args.shelf), "--slot={}".format(args.slot), "--vfatmask=0x{:x}".format(args.vfatmask if (args.vfatmask is not None) else amcBoard.getLinkVFATMask(ohN) ), ] # debug flag raised? if args.debug: cmd.append("-d") # Execute executeCmd(cmd,dirPath) print("Finished CFG_THR_ARM_DAC scan for shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) print("Finished all CFG_THR_ARM_DAC scans for all optohybrids on shelf{0} slot{1} in ohMask: 0x{2:x}".format(args.shelf,args.slot,args.ohMask)) return
def ultraScurve(args): """ Launches a call of ultraScurve.py args - object returned by argparse.ArgumentParser.parse_args() """ startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") # Determine number of OH's cardName = getCardName(args.shelf,args.slot) amcBoard = HwAMC(cardName, args.debug) print('opened connection') from gempython.vfatqc.utils.scanUtils import launchSCurve for ohN in range(0,amcBoard.nOHs): # Skip masked OH's if( not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf,args.slot,ohN) print("Launching scurve for shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) # Get & make the output directory dirPath = makeScanDir(args.slot, ohN, "scurve", startTime, args.shelf) logFile = "%s/scanLog.log"%(dirPath) # Launch the scurve launchSCurve( cardName = cardName, chMax = args.chMax, chMin = args.chMin, filename = "{}/SCurveData.root".format(dirPath), latency = args.latency, link = ohN, logFile = logFile, makeLogFile = True, mspl = args.mspl, nevts = args.nevts, setChanRegs = False, vfatmask = (args.vfatmask if (args.vfatmask is not None) else amcBoard.getLinkVFATMask(ohN)), voltageStepPulse = True, gemType = args.gemType, detType = args.detType) # Execute runCommand( ["chmod","-R","g+r",dirPath] ) print("Finished scurve for shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) print("Finished all scurves for all optohybrids on shelf{0} slot{1} in ohMask: 0x{2:x}".format(args.shelf,args.slot,args.ohMask)) return
def checkSbitMappingAndRate(args): """ Launches a call of checkSbitMappingAndRate.py args - object returned by argparse.ArgumentParser.parse_args() """ startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") # Determine number of OH's cardName = getCardName(args.shelf,args.slot) amcBoard = HwAMC(cardName, args.debug) print('opened connection') for ohN in range(0,amcBoard.nOHs): # Skip masked OH's if( not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf,args.slot,ohN) print("Checking SBIT Mapping for shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) # Get & make the output directory dirPath = makeScanDir(args.slot, ohN, "sbitMonInt", startTime, args.shelf) # Build Command cmd = [ "checkSbitMappingAndRate.py", "--gemType={}".format(args.gemType), "--detType={}".format(args.detType), "--shelf={}".format(args.shelf), "--slot={}".format(args.slot), "-f {}/SBitMappingAndRateData.root".format(dirPath), "-g {}".format(ohN), "--nevts={}".format(args.nevts), "--rates={}".format(args.rates), "--time={}".format(args.time), "--vfatmask=0x{:x}".format(args.vfatmask if (args.vfatmask is not None) else amcBoard.getLinkVFATMask(ohN) ), "--voltageStepPulse" ] # debug flag raised? if args.debug: cmd.append("-d") # Execute executeCmd(cmd,dirPath) print("Finished Checking SBIT Mapping for shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) print("Finished Checking SBIT Mapping for all optohybrids on shelf{0} slot{1} in ohMask: 0x{2:x}".format(args.shelf,args.slot,args.ohMask)) return
"--detType", type=str, help= "Detector type within gemType. If gemType is 'ge11' then this should be from list {0}; if gemType is 'ge21' then this should be from list {1}; and if type is 'me0' then this should be from the list {2}" .format(gemVariants['ge11'], gemVariants['ge21'], gemVariants['me0']), default="short") args = parser.parse_args() options = vars(args) mask = args.vfatmask # Open rpc connection to hw from gempython.tools.vfat_user_functions_xhal import * from gempython.vfatqc.utils.qcutilities import getCardName cardName = getCardName(args.shelf, args.slot) vfatBoard = HwVFAT(cardName, args.ohN, args.debug, args.gemType, args.detType) print 'opened connection' # Check options from gempython.vfatqc.utils.qcutilities import inputOptionsValid import os if not inputOptionsValid(options, vfatBoard.parentOH.parentAMC.fwVersion): exit(os.EX_USAGE) # Configure the amc13 print("initializing amc13") import uhal if args.debug: uhal.setLogLevelTo(uhal.LogLevel.INFO)
import subprocess,datetime,time startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") print startTime Date = startTime # Track the current pulse isCurrentPulse = (not options.voltageStepPulse) # Setup the output TTree from gempython.vfatqc.utils.treeStructure import gemTreeStructure gemData = gemTreeStructure('scurveTree','Tree Holding CMS GEM SCurve Data',scanmode.SCURVE) gemData.setDefaults(options, int(time.time())) # Open rpc connection to hw from gempython.vfatqc.utils.qcutilities import getCardName, inputOptionsValid cardName = getCardName(options.shelf,options.slot) vfatBoard = HwVFAT(cardName, options.gtx, options.debug, options.gemType, options.detType) print 'opened connection' # Check options from gempython.vfatqc.utils.confUtils import getChannelRegisters if not inputOptionsValid(options, vfatBoard.parentOH.parentAMC.fwVersion): exit(os.EX_USAGE) pass if options.scanmin not in range(256) or options.scanmax not in range(256) or not (options.scanmax > options.scanmin): print("Invalid scan parameters specified [min,max] = [%d,%d]"%(options.scanmin,options.scanmax)) print("Scan parameters must be in range [0,255] and min < max") exit(1) pass CHAN_MIN = options.chMin
def iterativeTrim(args, dict_dirPaths, identifier, dict_chanRegData=None, dict_calFiles=None): """ Takes an scurve at a given set of channel registers (all 0's if not provided) and returns a dictionary of numpy arrays with fit results (see gempythong.gemplotting.fitting.fitScanData for details on the output container). args - Namespace produced by ArgumentParser.parse_args dirPath - Output filepath location that scurve raw data should be saved at identifier - Unique string identifier to be used for each iteration chanRegData - structure numpy array containing channel register data, expected dtype values are: [('CALPULSE_ENABLE','bool'),('MASK','bool'),('ZCC_TRIM_POLARITY','bool'), ('ZCC_TRIM_AMPLITUDE','uint8'),('ARM_TRIM_POLARITY','bool'),('ARM_TRIM_AMPLITUDE','uint8')]. If provided these values will be written to the channel registers of all unmaksed VFATs. calInfo - Tuple of numpy arrays providing CFG_CAL_DAC calibration info, idx = 0 (1) for slopw (intercept) indexed by VFAT position """ from ctypes import c_uint32 import root_numpy as rp from gempython.vfatqc.utils.scanUtils import launchSCurve dictOfFiles = {} for ohN in range(0, amcBoard.nOHs): # Skip masked OH's if (not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf, args.slot, ohN) # Get Channel Register Info if dict_chanRegData is None: setChanRegs = False cArray_trimVal = None cArray_trimPol = None else: setChanRegs = True detName = chamber_config[ohKey] gemType = detName[:detName.find('-')].lower() cArray_trimVal = ( c_uint32 * (vfatsPerGemVariant[gemType] * CHANNELS_PER_VFAT))( *dict_chanRegData[ohN]["ARM_TRIM_AMPLITUDE"]) cArray_trimPol = ( c_uint32 * (vfatsPerGemVariant[gemType] * CHANNELS_PER_VFAT))( *dict_chanRegData[ohN]["ARM_TRIM_POLARITY"]) pass # Set filename of this scurve isZombie = True filename = "{:s}/SCurveData_{:s}.root".format(dict_dirPaths[ohN], identifier) dictOfFiles[ohKey] = (filename, chamber_config[ohKey], GEBtype[ohKey]) if os.path.isfile(filename): scurveRawFile = r.TFile(filename, "READ") isZombie = scurveRawFile.IsZombie() # Take the scurves in sequence (it is not possible to take scurves in parallel) if not isZombie: try: thisTree = scurveRawFile.scurveTree except AttributeError as error: print("Caught exception {:s}".format(error)) print("Going to re-take scurve corresponding to: {:s}".format( filename)) launchSCurve(calSF=args.calSF, cardName=getCardName(args.shelf, args.slot), chMax=args.chMax, chMin=args.chMin, debug=args.debug, filename=filename, latency=args.latency, link=ohN, mspl=args.pulseStretch, nevts=args.nevts, setChanRegs=setChanRegs, trimARM=cArray_trimVal, trimARMPol=cArray_trimPol, vfatmask=args.vfatmask, voltageStepPulse=not args.currentPulse) print("scurve finished") else: print("File {:s} either doesn't exist or is a zombie".format( filename)) print("Going to re-take scurve corresponding to: {:s}".format( filename)) launchSCurve(calSF=args.calSF, cardName=getCardName(args.shelf, args.slot), chMax=args.chMax, chMin=args.chMin, debug=args.debug, filename=filename, latency=args.latency, link=ohN, mspl=args.pulseStretch, nevts=args.nevts, setChanRegs=setChanRegs, trimARM=cArray_trimVal, trimARMPol=cArray_trimPol, vfatmask=args.vfatmask, voltageStepPulse=not args.currentPulse) print("scurve finished") pass # Make the analysis output directories and set permissions from gempython.utils.wrappers import runCommand for scurveFile in dictOfFiles.values(): runCommand( ["mkdir", "-p", "{0}".format(scurveFile[0].replace(".root", ""))]) os.system("chmod -R g+rw {0} 2> /dev/null".format( scurveFile[0].replace(".root", ""))) # Do the analysis in parallel from multiprocessing import Pool from gempython.gemplotting.utils.anautilities import getNumCores2Use, init_worker pool = Pool(getNumCores2Use(args), initializer=init_worker ) # Allocate number of CPU's based on getNumCores2Use() from gempython.gemplotting.utils.scurveAlgos import anaUltraScurveStar import itertools, sys, traceback try: print( "Launching scurve analysis processes, this may take some time, please be patient" ) pool.map_async( anaUltraScurveStar, itertools.izip( [args for geoAddr in dictOfFiles.keys()], # args namespace [scurveFile[0] for scurveFile in dictOfFiles.values()], # scurveFilename [dict_calFiles[geoAddr] for geoAddr in dictOfFiles.keys()], # calFile [scurveFile[2] for scurveFile in dictOfFiles.values()], # GEBtype [ scurveFile[0].replace(".root", "") for scurveFile in dictOfFiles.values() ], # outputDir [None for geoAddr in dictOfFiles.keys()] # vfatList )).get(7200) # wait at most 2 hours except KeyboardInterrupt: printRed("Caught KeyboardInterrupt, terminating workers") pool.terminate() raise Exception("Analysis failed.") except Exception as err: printRed("Caught {0}: {1}, terminating workers".format( type(err), err.message)) pool.terminate() traceback.print_exc(file=sys.stdout) raise Exception("Analysis failed.") except: # catch *all* exceptions e = sys.exc_info()[0] printRed("Caught non-Python Exception %s" % (e)) pool.terminate() traceback.print_exc(file=sys.stdout) raise Exception("Analysis failed.") else: printGreen("Analysis Completed Successfully") pool.close() pool.join() scurveFitResults = {} for ohN in range(0, amcBoard.nOHs): # Skip masked OH's if (not ((args.ohMask >> ohN) & 0x1)): continue from gempython.gemplotting.utils.anaInfo import tree_names filename = "{0}/{1}".format( dict_dirPaths[ohN], tree_names["itertrimAna"][0].format(IDENTIFIER=identifier)) # Load the file r.TH1.AddDirectory(False) scanFile = r.TFile(filename, "READ") if not scanFile.IsOpen(): raise IOError( "iterativeTrim(): File {0} is not open or is not readable". format(filename)) if scanFile.IsZombie(): raise IOError( "iterativeTrim(): File {0} is a zombie".format(filename)) # Determine vfatID list_bNames = ['vfatN', 'vfatID'] array_vfatData = rp.tree2array(tree=scanFile.scurveFitTree, branches=list_bNames) array_vfatData = np.unique(array_vfatData) # Get scurve data for this arm dac value (used for boxplots) list_bNames = ['vfatCH', 'vfatN', 'threshold', 'noise'] scurveFitData = rp.tree2array(tree=scanFile.scurveFitTree, branches=list_bNames) scurveFitResults[ohN] = scurveFitData return scurveFitResults
def launchArgs(shelf, slot, link, run, armDAC, armDACBump, configType, cName, debug=False, gemType="ge11"): dataPath = os.getenv('DATA_PATH') from gempython.vfatqc.utils.qcutilities import getCardName from gempython.tools.vfat_user_functions_xhal import HwVFAT cardName = getCardName(shelf, slot) if gemType == "ge11": detType = "short" elif gemType == "ge21": detType = "m1" else: print("GEM types other than GE1/1 and GE2/1 aren't supported yet") os.exit(1) vfatBoard = HwVFAT(cardName, link, debug, gemType, detType) from gempython.vfatqc.utils.namespace import Namespace args = Namespace(applyMasks=False, chConfig=None, compare=False, debug=debug, filename=None, run=run, vt1=armDAC, vt1bump=armDACBump, vt2=0, vfatConfig=None, vfatmask=vfatBoard.parentOH.getVFATMask(), zeroChan=False) from gempython.utils.gemlogger import printYellow if (configType & 0x1): # Set vfatConfig vfatConfig = "{0}/configs/vfatConfig_{1}.txt".format(dataPath, cName) # Channel config if os.path.isfile(chConfig): args.chConfig = chConfig else: print("No channel configuration exists for {0}".format(cName)) # VFAT Config if os.path.isfile(vfatConfig): args.vfatConfig = vfatConfig else: printYellow("No vfat configuration exists for {0}".format(cName)) if ((configType & 0x2) > 0): # Set chConfig and potentially channel masks chConfig = "{0}/configs/chConfig_{1}.txt".format(dataPath, cName) if os.path.isfile(chConfig): args.chConfig = chConfig if ((configType & 0x4) > 0): args.applyMasks = True else: printYellow( "No channel configuration exists for {0}".format(cName)) if ((configType & 0x8) > 0): # Zero all channel registers args.chConfig = None args.applyMasks = False args.zeroChan = True pass from gempython.utils.gemlogger import getGEMLogger import logging gemlogger = getGEMLogger(__name__) gemlogger.setLevel(logging.ERROR) from gempython.vfatqc.utils.confUtils import configure from subprocess import CalledProcessError try: configure(args, vfatBoard) except CalledProcessError as e: print "Caught exception", e pass return
def ultraLatency(args): """ Launches a call of ultraLatency.py args - object returned by argparse.ArgumentParser.parse_args() """ startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") # Determine number of OH's cardName = getCardName(args.shelf,args.slot) amcBoard = HwAMC(cardName, args.debug) print('opened connection') for ohN in range(0,amcBoard.nOHs): # Skip masked OH's if( not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf,args.slot,ohN) print("Launching CFG_LATENCY scan for shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) # Get & make the output directory dirPath = makeScanDir(args.slot, ohN, "latency", startTime, args.shelf) # Get base command cmd = [ "ultraLatency.py", "--gemType={}".format(args.gemType), "--detType={}".format(args.detType), "--filename={}/LatencyScanData.root".format(dirPath), "-g {}".format(ohN), "--mspl={}".format(args.mspl), "--nevts={}".format(args.nevts), "--scanmax={}".format(args.scanmax), "--scanmin={}".format(args.scanmin), "--shelf={}".format(args.shelf), "--slot={}".format(args.slot), "--stepSize={}".format(args.stepSize), "--vfatmask=0x{:x}".format(args.vfatmask if (args.vfatmask is not None) else amcBoard.getLinkVFATMask(ohN) ), ] # debug flag raised? if args.debug: cmd.append("-d") # Additional options if args.throttle is not None: cmd.append( "--throttle=%i"%(args.throttle) ) if args.amc13local: cmd.append( "--amc13local") if args.t3trig: cmd.append( "--t3trig") if args.randoms is not None: cmd.append( "--randoms=%i"%(args.randoms)) if args.internal: cmd.append( "--internal") cmd.append( "--voltageStepPulse") if args.chan is not None: cmd.append("--chan={}".format(args.chan)) if args.vcal is not None: cmd.append("--vcal={}".format(args.vcal)) # Execute executeCmd(cmd,dirPath) print("Finished CFG_LATENCY scan for shelf{0} slot{1} OH{2} detector {3}".format(args.slot,args.shelf,ohN,chamber_config[ohKey])) print("Finished all CFG_LATENCY scans for all optohybrids on shelf{0} slot{1} in ohMask: 0x{2:x}".format(args.shelf,args.slot,args.ohMask)) return
def iterTrim(args): """ Launches a call of iterativeTrim.py args - object returned by argparse.ArgumentParser.parse_args() """ startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") # Determine number of OH's cardName = getCardName(args.shelf,args.slot) amcBoard = HwAMC(cardName, args.debug) print("opened connection") # Get DATA_PATH dataPath = os.getenv("DATA_PATH") for ohN in range(0,amcBoard.nOHs): # Skip masked OH's if( not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf,args.slot,ohN) # Get & make the output directory dirPath = makeScanDir(args.slot, ohN, "iterTrim", startTime, args.shelf) calDacCalFile = "{0}/{1}/calFile_calDac_{1}.txt".format(dataPath,chamber_config[ohKey]) calDacCalFileExists = os.path.isfile(calDacCalFile) if not calDacCalFileExists: print("Skipping shelf{0} slot{1} OH{2}, detector {3}, missing CFG_CAL_DAC Calibration file:\n\t{2}".format( args.shelf, args.slot, ohN, chamber_config[ohKey], calDacCalFile)) continue print("iterativeTrimming shelf{0} slot{1} 0x{2:x}".format(args.shelf,args.slot,args.ohMask,chamber_config[ohKey])) # Get base command cmd = [ "iterativeTrim.py", "{}".format(args.shelf), "{}".format(args.slot), "0x{:x}".format(args.ohMask), "--chMax={}".format(args.chMax), "--chMin={}".format(args.chMin), "--latency={}".format(args.latency), "--maxIter={}".format(args.maxIter), "--nevts={}".format(args.nevts), "--vfatmask=0x{:x}".format(args.vfatmask if (args.vfatmask is not None) else amcBoard.getLinkVFATMask(ohN) ), "--sigmaOffset={}".format(args.sigmaOffset), "--highTrimCutoff={}".format(args.highTrimCutoff), "--highTrimWeight={}".format(args.highTrimWeight), "--highNoiseCut={}".format(args.highNoiseCut) ] # debug flag raised? if args.debug: cmd.append("-d") # add calFile flag if args.calFileCAL: cmd.append("--calFileCAL") # Additional optional arguments if args.armDAC is not None: cmd.append("--armDAC={}".format(args.armDAC)) # add CPU usage flag if args.light: cmd.append("--light") if args.medium: cmd.append("--medium") if args.heavy: cmd.append("--heavy") # Execute executeCmd(cmd,dirPath) print("Finished iterativeTrimming on shelf{0} slot{1} in ohMask: 0x{2:x}".format(args.shelf,args.slot,args.ohMask)) return
def trimChamberV3(args): """ Launches a call of trimChamberV3.py args - object returned by argparse.ArgumentParser.parse_args() """ startTime = datetime.datetime.now().strftime("%Y.%m.%d.%H.%M") # Determine number of OH's cardName = getCardName(args.shelf,args.slot) amcBoard = HwAMC(cardName, args.debug) print('opened connection') # Get DATA_PATH dataPath = os.getenv("DATA_PATH") for ohN in range(0,amcBoard.nOHs): # Skip masked OH's if( not ((args.ohMask >> ohN) & 0x1)): continue ohKey = (args.shelf,args.slot,ohN) print("Trimming shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) # Get & make the output directory dirPath = makeScanDir(args.slot, ohN, "trimV3", startTime, args.shelf) calDacCalFile = "{0}/{1}/calFile_calDac_{1}.txt".format(dataPath,chamber_config[ohKey]) calDacCalFileExists = os.path.isfile(calDacCalFile) if not calDacCalFileExists: print("Skipping shelf{0} slot{1} OH{2}, detector {3}, missing CFG_CAL_DAC Calibration file:\n\t{2}".format( args.shelf, args.slot, ohN, chamber_config[ohKey], calDacCalFile)) continue # Get base command cmd = [ "trimChamberV3.py", "--gemType {}".format(args.gemType), "--detType {}".format(args.detType), "--calFileCAL={}".format(calDacCalFile), "--chMax={}".format(args.chMax), "--chMin={}".format(args.chMin), "--dirPath={}".format(dirPath), "-g {}".format(ohN), "--latency={}".format(args.latency), "--mspl={}".format(args.mspl), "--nevts={}".format(args.nevts), "--shelf={}".format(args.shelf), "--slot={}".format(args.slot), "--trimPoints={}".format(args.trimPoints), "--vfatmask=0x{:x}".format(args.vfatmask if (args.vfatmask is not None) else amcBoard.getLinkVFATMask(ohN) ), "--voltageStepPulse" ] # debug flag raised? if args.debug: cmd.append("-d") # Additional optional arguments if args.armDAC is not None: cmd.append("--armDAC={}".format(args.armDAC)) else: # Check to see if a vfatConfig exists vfatConfigFile = "{0}/configs/vfatConfig_{1}.txt".format(dataPath,chamber_config[ohKey]) if os.path.isfile(vfatConfigFile): cmd.append("--vfatConfig={}".format(vfatConfigFile)) pass pass # Execute executeCmd(cmd,dirPath) print("Finished trimming shelf{0} slot{1} OH{2} detector {3}".format(args.shelf,args.slot,ohN,chamber_config[ohKey])) print("Finished trimming all optohybrids on shelf{0} slot{1} in ohMask: 0x{2:x}".format(args.shelf,args.slot,args.ohMask)) return