Пример #1
0
def addMyArgs(parser):
    # Use arggroup to get these arguments in their own sub-section (of --help)
    parser.defineArgGroup('Sleep_trf', 'Sleep_trf specific options')
    parser.add_argument('--dust',
                        type=trfArgClasses.argFactory(trfArgClasses.argInt),
                        group='Sleep_trf',
                        help='How much dust to throw (=sleep time in seconds)',
                        default=trfArgClasses.argInt(10))
Пример #2
0
def addTrigFTKSimOptions(parser, nsubregions=4):
    parser.defineArgGroup('TrigFTKSim',
                          'Fast tracker simulation generic options')

    parser.add_argument('--NBanks',
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Number of pattern banks',
                        group='TrigFTKSim')
    # Here we set a default value as the merger wants this explicitly
    parser.add_argument('--NSubRegions',
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Number of sub-regions',
                        group='TrigFTKSim',
                        default=trfArgClasses.argInt(nsubregions, runarg=True))
    parser.add_argument('--pmap_path',
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='Location of pmap file',
                        group='TrigFTKSim')
    parser.add_argument('--pmapunused_path',
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='Location of pmapunused file',
                        group='TrigFTKSim')
    parser.add_argument('--pmapcomplete_path',
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='Location of 11L pmap file',
                        group='TrigFTKSim')
    parser.add_argument('--rmap_path',
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='Location of rmap file',
                        group='TrigFTKSim')

    parser.add_argument('--IBLMode',
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Enalbe the IBL geometry',
                        group='TrigFTKSim')

    parser.add_argument(
        '--StoreAllSS',
        type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
        help='If enabled, store all SS, not just those in roads',
        group='TrigFTKSim')

    parser.add_argument('--FixEndCapL0',
                        type=trfArgClasses.argFactory(trfArgClasses.argBool,
                                                      runarg=True),
                        help='Fix EndCap L0 clustering',
                        group='TrigFTKSim')

    parser.add_argument('--UseTSPBank',
                        type=trfArgClasses.argFactory(trfArgClasses.argBool,
                                                      runarg=True),
                        help='TSP bank utilisation',
                        group='TrigFTKSim')
    parser.add_argument('--UseCompressedBank',
                        type=trfArgClasses.argFactory(trfArgClasses.argBool,
                                                      runarg=True),
                        help='use compressed bank algorithm',
                        group='TrigFTKSim')

    parser.add_argument('--ReadFTKHits',
                        type=trfArgClasses.argFactory(trfArgClasses.argBool,
                                                      runarg=True),
                        help='Read FTKHits directly',
                        group='TrigFTKSim')

    # Cannot take maxEvents as an argument from addAthenaArguments() as it will have the wrong
    # default ('first', but we need 'all')
    parser.add_argument(
        '--maxEvents',
        group='TrigFTKSim',
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepInt,
                                      runarg=True,
                                      defaultSubstep='all'),
        nargs='+',
        metavar='substep:maxEvents',
        help=
        'Set maximum events for each processing step (default for this transform is to set for all substeps)'
    )

    parser.add_argument(
        "--DuplicateGanged",
        group="TrigFTKSim",
        default=trfArgClasses.argInt(1, runarg=True),
        help="Duplicate ganged pixels so we don't lose efficiency",
        type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True))

    parser.add_argument(
        "--GangedPatternReco",
        group="TrigFTKSim",
        default=trfArgClasses.argInt(0, runarg=True),
        help="Pattern recognition to partially remove duplication",
        type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True))

    ### default here need to be 'all' since we have many steps
    parser.add_argument(
        "--firstEventFTK",
        "--FirstEventFTK",
        group="TrigFTKSim",
        help="the number of the first event to process, specifically for FTK",
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepInt,
                                      runarg=True,
                                      defaultSubstep='all'))

    ### default here need to be 'all' since we have many steps
    parser.add_argument(
        "--firstEvent",
        "--FirstEvent",
        group="TrigFTKSim",
        help=
        "the number of the first event to process, specifically not for FTK",
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepInt,
                                      runarg=True,
                                      defaultSubstep='all'))

    ### default here need to be 'all' since we have many steps, though for RDO_FTK running we don't want them all (only r2e and r2eFTK)
    parser.add_argument(
        "--skipEvents",
        "--SkipEvents",
        nargs='+',
        group="TrigFTKSim",
        help="the number of events to skip, needed for RDO_FTK running",
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepInt,
                                      runarg=True,
                                      defaultSubstep='all'))

    parser.add_argument(
        '--postExec',
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepList),
        nargs='+',
        metavar='substep:POSTEXEC',
        group='TrigFTKSim',
        help=
        'Python code to execute after main job options are included (can be optionally limited to a single substep)'
    )

    parser.add_argument(
        '--postInclude',
        group='TrigFTKSim',
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepList,
                                      splitter=','),
        nargs='+',
        metavar='substep:POSTINCLUDE',
        help=
        'Python configuration fragment to include after main job options (can be optionally limited to a single substep). Will split on commas: frag1.py,frag2.py is understood.'
    )

    parser.add_argument(
        '--preExec',
        group='TrigFTKSim',
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepList),
        nargs='+',
        metavar='substep:PREEXEC',
        help=
        'Python code to execute before main job options are included (can be optionally limited to a single substep)'
    )

    parser.add_argument(
        '--preInclude',
        group='TrigFTKSim',
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepList,
                                      splitter=','),
        nargs='+',
        metavar='substep:PREINCLUDE',
        help=
        'Python configuration fragment to include before main job options (can be optionally limited to a single substep). Will split on commas: frag1.py,frag2.py is understood.'
    )

    #JDC:
    parser.add_argument('--ConstantsDir',
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='Directory where input files are kept',
                        group='TrigFTKSim')
    parser.add_argument('--FitConstantsVersion',
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='Version of fit constants',
                        group='TrigFTKSim')
    parser.add_argument('--PatternsVersion',
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='Version of patterns',
                        group='TrigFTKSim')
    parser.add_argument('--separateSubRegFitConst',
                        default=0,
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Use separate fit constant for each subregion',
                        group='TrigFTKSim')
    parser.add_argument('--useDBPath',
                        default=0,
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Query the Data Base to get File Paths',
                        group='TrigFTKSim')
    parser.add_argument('--runNum',
                        default=0,
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Run Number',
                        group='TrigFTKSim')
    parser.add_argument('--versionTag',
                        default=0,
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True),
                        help='COOL tag for a different version',
                        group='TrigFTKSim')
    #end JDC

    parser.add_argument(
        '--FTKSetupTag',
        type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
        help=
        'Setup the FTK architecture tag, if specific values are also used they have priority',
        group='TrigFTKSim')

    return None
Пример #3
0
    def preExecute(self, input=set(), output=set()):

        """ Execute runInfo, set environment and check inputtype"""
        # Execute runInfo.py
        runArgs=self.conf._argdict

        checkFileList(runArgs['input'])
        namelist=[]
        for i in range(0,len(dsDict['input'])):
            namelist.append(dsDict['input'][i]['file'])
            
        self.conf.addToArgdict('inputNames', trfArgClasses.argList(namelist))

        nName=namelist[0].count('/')
        fileName=namelist[0].split('/')[nName]
        projectName=str(fileName.split('.')[0])


        if not 'doRunInfo' in runArgs:
            self.conf.addToArgdict('doRunInfo', trfArgClasses.argBool(False))
        else:
            if runArgs['doRunInfo']._value:
                import SCT_CalibAlgs.runInfo as runInfo

                print "RunNumber for the runInfo = " + str(RunNumber) + " " + Stream
                runInfo.main(RunNumber, projectName)

        if not 'splitNoisyStrip' in runArgs:
            self.conf.addToArgdict('splitNoisyStrip', trfArgClasses.argInt(0))
        if not 'doRunSelector' in runArgs:
            self.conf.addToArgdict('doRunSelector', trfArgClasses.argBool(False))

            
            
        # Set STAGE_SVCCLASS
        if not SvcClass is '' and not SvcClass is None:
            os.environ['STAGE_SVCCLASS']=SvcClass

        # Check input type
        inputtype=dsDict['input'][0]['dataset'].split('.')[4]
        print "Input type = " + inputtype
        self.conf.addToArgdict('InputType', trfArgClasses.argString(inputtype))


        # check which parts to be run
        if not 'part' in runArgs:
            self.conf.addToArgdict('part', trfArgClasses.argString('doNoisyStrip'))

        part=runArgs['part']._value


        

        for ipart in part:
            if not ipart in ['doNoisyStrip','doNoiseOccupancy','doDeadChip','doDeadStrip','doHV','doBSErrorDB','doRawOccupancy','doEfficiency','doLorentzAngle','doNoisyLB']:
                self._errMsg = 'Argument part=%s does not match any of the possible candidates' % ipart
                raise trfExceptions.TransformValidationException(trfExit.nameToCode('TRF_ARG_ERRO'), self._errMsg)


        # get prefix
        if not 'prefix' in runArgs:
            self.conf.addToArgdict('prefix', trfArgClasses.argString(''))
        

        prefix=runArgs['prefix']._value

            
        # set job number
        jobnb=''
        # find seperator for jobnumber
        if prefix is not '' : 
            sep=prefix.find('._')
            if ( sep != -1 ) :
                jobnb=prefix[sep+1:]
            elif ( prefix.rfind('#_') != -1 ):
                sep=prefix.rfind('#_')
                jobnb=prefix[sep+1:]
            
            # find seperator for prefix
            sep=prefix.find('#')
            if (sep != -1) :
                prefix=prefix[:sep]
            elif (prefix.find('._') != -1):
                sep=prefix.rfind('._')
                prefix=prefix[:sep]

            # set prefix and jobnumber
            prefix+='.'+jobnb
            runArgs['prefix']._value = prefix


        # When ATLAS is NOT in standby the SCT is, the hitmap root files have 0 events,
        # even though the calibration_SCTNoise streams has 10k+ events.
        # If the noisy strips task is generated, the jobs will fail. A.N has implemented
        # a condition a t0 level so they won't be defined. However,
        # when runSelector uses AtlRunQuery to look for the runs that have 10k+ events
        # in the calibration_SCTNoise stream, those runs that failed or were skipped
        # will appear as waiting to be uploaded, making the rest keep on hold.

        # We include a protection against those cases: if the summed number of events
        # of hitmap files is <10k, we don't execute the noisy strips. Rather, we exit
        # with 'success' status, so the job won't fail at t0, and update the value
        # of the last run uploaded as if this run had been uploaded, to avoid the
        # next run being indefinitely on hold
        # print 'Number of events: ', NumberOfEvents
        if 'doNoisyStrip' in part and runArgs['splitNoisyStrip']._value==2 and NumberOfEvents<10000:
            self._isValidated = True
            self._trf._exitCode = 0
            self._trf._exitMsg = 'Noisy strips trying to read root files with 0 events. Gracefully exit and update lastRun counter to %s' %(RunNumber)

            updateLastRun(RunNumber)
            emptyDic = {}
            self._trf._dataDictionary = emptyDic

            resetTrfSignalHandlers()
            self._trf.generateReport(fast=True)
            sys.exit(0)

#                raise trfExceptions.TransformValidationException(trfExit.nameToCode('TRF_EXEC_SETUP_FAIL'), self._errMsg)


        if jobnb is not '':
            self.conf.addToArgdict('JobNumber', trfArgClasses.argString(jobnb))

        # get RunNumber from datasetName
        if not RunNumber == -1:
            self.conf.addToArgdict('RunNumber', trfArgClasses.argInt(RunNumber))
        if not Stream == '':
            self.conf.addToArgdict('Stream', trfArgClasses.argString(Stream))

        # Do other prerun actions
        super(SCTCalibExecutor, self).preExecute(input,output)
Пример #4
0
def addStdEvgenArgs(parser):
    parser.defineArgGroup("Evgen", "Event generator options")

    # TODO: Try to automatically determine the run number from the JO name, if not specified
    parser.add_argument('--runNumber',
                        '--RunNumber',
                        group='Evgen',
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Manual run number setting')

    parser.add_argument("--ecmEnergy",
                        "--EcmEnergy",
                        group="Evgen",
                        default=trfArgClasses.argFloat(13000, runarg=True),
                        help="centre-of-mass energy parameter in GeV",
                        type=trfArgClasses.argFactory(trfArgClasses.argFloat,
                                                      runarg=True))

    parser.add_argument(
        "--firstEvent",
        "--FirstEvent",
        group="Evgen",
        default=trfArgClasses.argInt(1, runarg=True),
        help="the number of the first event in the output data file",
        type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True))

    parser.add_argument(
        "--randomSeed",
        "--RandomSeed",
        "--seed",
        group="Evgen",
        nargs="+",
        default=trfArgClasses.argSubstepInt("all:12345"),
        help="a seed for the MC generator random number engines",
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepInt))

    parser.add_argument(
        "--printEvts",
        group="Evgen",
        default=trfArgClasses.argInt(5, runarg=True),
        help="number of full event dumps to print out for debugging",
        type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True))

    parser.add_argument(
        "--jobConfig",
        "--JobConfig",
        "--jo",
        group="Evgen",
        nargs="+",
        help="a comma-separated list of job configuration script files",
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepList,
                                      runarg=True))

    # TODO: Add "--eventFile"?
    parser.add_argument(
        "--inputGeneratorFile",
        "--inputGenEventFile",
        "--inputGenFile",
        "--InputGeneratorFile",
        group="Evgen",
        help="optional parton-level events file to be processed",
        type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True))

    # TODO: Add "--confFile"?
    parser.add_argument("--inputGenConfFile",
                        "--InputGenConfFile",
                        group="Evgen",
                        help="optional generator configuration file",
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True))

    # parser.add_argument("--inputHepMCFile", group="Evgen",
    #                     help="optional fully showered HepMC input event file",
    #                     type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True))

    parser.add_argument(
        "--inputEVNTFile",
        group="Evgen",
        help="input EVNT file (for use with e.g. Rivet)",
        type=trfArgClasses.argFactory(trfArgClasses.argEVNTFile,
                                      io='input',
                                      runarg=True))

    parser.add_argument(
        "--inputEVNT_PreFile",
        group="Evgen",
        help="input evgen file for processing with afterburner, e.g. EvtGen",
        type=trfArgClasses.argFactory(trfArgClasses.argEVNTFile,
                                      io='input',
                                      runarg=True))

    parser.add_argument(
        "--evgenJobOpts",
        "--EvgenJobOpts",
        group="Evgen",
        help=
        "download and install the EvgenJobOpts tarball with the given name",
        type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True))

    # TODO: make optional: by default auto-determine from the JO name. If NONE, don't write?
    parser.add_argument(
        "--outputEVNTFile",
        "--OutputEVNTFile",
        group="Evgen",
        help="POOL file into which generated events will be written",
        type=trfArgClasses.argFactory(trfArgClasses.argEVNTFile,
                                      io='output',
                                      runarg=True))

    parser.add_argument(
        "--outputEVNT_PreFile",
        "--OutputEVNT_PreFile",
        group="Evgen",
        help=
        "POOL file into which pre-afterburner generated events will be written",
        type=trfArgClasses.argFactory(trfArgClasses.argEVNTFile,
                                      io='output',
                                      runarg=True))

    parser.add_argument('--outputNTUP_TRUTHFile',
                        type=trfArgClasses.argFactory(
                            trfArgClasses.argNTUPFile,
                            io='output',
                            treeNames=['truth']),
                        help='Output NTUP_TRUTH file',
                        group='Evgen')

    parser.add_argument("--outputYODAFile",
                        group="Evgen",
                        help="Name of YODA file for Rivet histo output",
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True))

    parser.add_argument(
        "--rivetAnas",
        group="Evgen",
        help=
        "a comma-separated list of Rivet analyses to run on the resulting events",
        type=trfArgClasses.argFactory(trfArgClasses.argList, runarg=True))

    parser.add_argument(
        "--outputTXTFile",
        group="Evgen",
        help="optional output TXT file for LHEF events, default is None",
        type=trfArgClasses.argFactory(trfArgClasses.argLHEFile,
                                      io='output',
                                      runarg=True))

    parser.add_argument("--generatorRunMode",
                        group="Evgen",
                        help="Run mode to pass on to the event generator",
                        default=trfArgClasses.argString("run", runarg=True),
                        choices=[
                            trfArgClasses.argString("read", runarg=True),
                            trfArgClasses.argString("build", runarg=True),
                            trfArgClasses.argString("integrate", runarg=True),
                            trfArgClasses.argString("mergegrids", runarg=True),
                            trfArgClasses.argString("run", runarg=True)
                        ],
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True))

    parser.add_argument("--generatorJobNumber",
                        group="Evgen",
                        help="Job number to pass on to the event generator",
                        default=trfArgClasses.argInt(0, runarg=True),
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True))

    parser.add_argument('--lheOnly',
                        '--lheOnly',
                        group='Evgen',
                        default=trfArgClasses.argInt(0, runarg=True),
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True),
                        help='Set to 1 if Evgen file should be removed')

    parser.add_argument("--localPath",
                        group="Evgen",
                        help="Name of local path to JOs",
                        type=trfArgClasses.argFactory(trfArgClasses.argString,
                                                      runarg=True))

    parser.add_argument(
        '--saveList',
        '--saveList',
        group='Evgen',
        help=
        "a comma-separated list of files to be saved in output or a single digit if the whole output directory is to be saved",
        type=trfArgClasses.argFactory(trfArgClasses.argSubstepList,
                                      runarg=True))

    parser.add_argument(
        '--cleanOut',
        '--cleanOut',
        group='Evgen',
        default=trfArgClasses.argInt(0, runarg=True),
        type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
        help=
        'Set to any digit !=0 if the output files should be cleaned up --saveList may help to save selected files'
    )
def addMyArgs(parser):
    # Use arggroup to get these arguments in their own sub-section (of --help)
    parser.defineArgGroup('mdt_calib_ntuple_tf',
                          'MDT calib ntuple job specific options')
    parser.add_argument('--inputCSFiles',
                        type=argFactory(trfArgClasses.argList),
                        help='Input calibration stream file(s)',
                        group='mdt_calib_ntuple_tf')
    parser.add_argument('--ntupleFile',
                        type=argFactory(trfArgClasses.argString),
                        help='Output calib ntuple',
                        group='mdt_calib_ntuple_tf')

    # Cannot use normal maxEvents and skipEvents because these seem to be
    # reserved for special use by transform framework, hence use different argument names.
    parser.add_argument("--Events",
                        group="mdt_calib_ntuple_tf",
                        default=trfArgClasses.argInt(-1, runarg=True),
                        help="the number of events to process",
                        type=trfArgClasses.argFactory(trfArgClasses.argInt,
                                                      runarg=True))
    parser.add_argument(
        "--Skip",
        group="mdt_calib_ntuple_tf",
        default=trfArgClasses.argInt(0, runarg=True),
        help="the number of events to skip at beginning of the file",
        type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True))

    parser.add_argument('--dbT0Tag',
                        type=argFactory(trfArgClasses.argString),
                        default='DEFAULT',
                        help='Specify T0 Tag',
                        group='mdt_calib_ntuple_tf')
    parser.add_argument('--dbRTTag',
                        type=argFactory(trfArgClasses.argString),
                        default='DEFAULT',
                        help='Specify RT Tag',
                        group='mdt_calib_ntuple_tf')
    parser.add_argument('--dbT0Sql',
                        type=argFactory(trfArgClasses.argString),
                        default='DEFAULT',
                        help='Specify SQLite file for T0s',
                        group='mdt_calib_ntuple_tf')
    parser.add_argument('--dbRTSql',
                        type=argFactory(trfArgClasses.argString),
                        default='DEFAULT',
                        help='Specify SQLite file for RTs',
                        group='mdt_calib_ntuple_tf')
    # Transform boolean variables will not be created in runArgs unless you specify them on command line
    # Hence, in the skeleton you need to check if they exist before you use them.
    parser.add_argument('--useAlign',
                        type=argFactory(trfArgClasses.argBool),
                        help='Use Alignment corrections',
                        group='mdt_calib_ntuple_tf')
    #  segOnly False results in calib ntuple not being filled
    #  parser.add_argument('--segOnly', type=argFactory(trfArgClasses.argBool),
    #                      help='Segments only', group='mdt_calib_ntuple_tf')
    #  Only standalone exists anymore and is enabled by default so there is no reason to set it anymore
    #  parser.add_argument('--moore', type=argFactory(trfArgClasses.argBool),
    #                      help='Use Moore segments + tracks', group='mdt_calib_ntuple_tf')
    #  parser.add_argument('--mboy', type=argFactory(trfArgClasses.argBool),
    #                      help='Use Muonboy segments + tracks', group='mdt_calib_ntuple_tf')
    #  parser.add_argument('--standalone', type=argFactory(trfArgClasses.argBool),
    #                      help='Use Standalone tracks', group='mdt_calib_ntuple_tf')
    parser.add_argument('--doSegmentT0Fit',
                        type=argFactory(trfArgClasses.argBool),
                        help='Do Segment T0 Fits',
                        group='mdt_calib_ntuple_tf')
    parser.add_argument('--doCSC',
                        type=argFactory(trfArgClasses.argBool),
                        help='Do CSC',
                        group='mdt_calib_ntuple_tf')
    parser.add_argument(
        '--rawTgc',
        type=argFactory(trfArgClasses.argBool),
        help='put rawTgc and rawTgcCoin branches in calib ntuple',
        group='mdt_calib_ntuple_tf')
    #  doSim is not even used in the skeleton, so skip it.
    #  parser.add_argument('--doSim', type=argFactory(trfArgClasses.argBool),
    #                      help='Do Simulated data (whatever that means)', group='mdt_calib_ntuple_tf')
    #  Not sure what the use case is for these, but leave them be.
    parser.add_argument('--lumiBlockNumberFromCool',
                        type=argFactory(trfArgClasses.argBool),
                        help='Fetch Lumiblock Number from COOL',
                        group='mdt_calib_ntuple_tf')
    parser.add_argument('--runNumberFromCool',
                        type=argFactory(trfArgClasses.argBool),
                        help='Fetch Run Number from COOL (?)',
                        group='mdt_calib_ntuple_tf')
Пример #6
0
def addFTKSimulationArgs(parser):
    # Add a specific FTK argument group
    parser.defineArgGroup('TrigFTKSim', 'Fast tracker simulation options')

    parser.add_argument('--NBanks', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='Number of pattern banks', group='TrigFTKSim')
    # Here we set a default value as the merger wants this explicitly
    parser.add_argument('--NSubRegions', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='Number of sub-regions', group='TrigFTKSim', default=trfArgClasses.argInt(subregions, runarg=True))


    parser.add_argument('--pmap_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of pmap file', group='TrigFTKSim')
    parser.add_argument('--pmapunused_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of pmapunused file', group='TrigFTKSim')
    parser.add_argument('--pmapcomplete_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of 11L pmap file', group='TrigFTKSim')
    parser.add_argument('--rmap_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of rmap file', group='TrigFTKSim')
    parser.add_argument('--loadHWConf_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of HW configuration file', group='TrigFTKSim')
    parser.add_argument('--HWNDiff', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
        help="Hit Warrior threshold", group='TrigFTKSim')
    parser.add_argument('--HitWarrior', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
        help="Hit Warrior type: 0 none, 1 local, 2 global (def)", group='TrigFTKSim')

    parser.add_argument('--ssmap_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of ssmap file', group='TrigFTKSim')
    parser.add_argument('--ssmaptsp_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of ssmaptsp file', group='TrigFTKSim')
    parser.add_argument('--ssmapunused_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of ssmapunused file', group='TrigFTKSim')

    parser.add_argument('--badmap_path', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of badmap file', group='TrigFTKSim')
    parser.add_argument('--badmap_path_for_hit', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Location of badmap file for hits', group='TrigFTKSim')
    parser.add_argument('--UseTSPBank', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help='TSP bank utilisation', group='TrigFTKSim')
    parser.add_argument('--DBBankLevel', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='DBBankLevel', group='TrigFTKSim')
    parser.add_argument('--TSPSimulationLevel', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='TSPSimulationLevel', group='TrigFTKSim')
    parser.add_argument('--TSPMinCoverage', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='TSPMinCoverage', group='TrigFTKSim')

    parser.add_argument('--IBLMode',type=trfArgClasses.argFactory(trfArgClasses.argInt,runarg=True),
                        help='Enalbe the IBL geometry',group='TrigFTKSim')

    parser.add_argument("--PixelClusteringMode",type=trfArgClasses.argFactory(trfArgClasses.argInt,runarg=True),
                        help="Set the pixel clustering mode: 0 default, 1 ToT+pixel center",group="TrigFTKSim")
    parser.add_argument("--Ibl3DRealistic",type=trfArgClasses.argFactory(trfArgClasses.argBool,runarg=True),
                        help="Do the IBL 3D realistic(HWlike) clustering? Default is false",group="TrigFTKSim")
    parser.add_argument('--SctClustering',type=trfArgClasses.argFactory(trfArgClasses.argBool,runarg=False),
                        help="Set the SCT clustering [def: False]", group="TrigFTKSim")

    parser.add_argument('--MakeCache', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help='Enable MakeCache', group='TrigFTKSim')
    parser.add_argument('--CachePath', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='CachePath', group='TrigFTKSim')
    parser.add_argument("--CachedBank", type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help="Interpret the pattern bank has a cache", group="TrigFTKSim")
    parser.add_argument("--SectorsAsPatterns", type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help="If 1 allows to use a list of sectors as pattern bank, default 0")

    parser.add_argument('--DoRoadFile', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help='Enable roads file', group='TrigFTKSim')
    parser.add_argument('--RoadFilesDir', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='RoadFilesDir', group='TrigFTKSim')
    parser.add_argument('--SaveRoads', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help='Save roads file', group='TrigFTKSim')

    parser.add_argument('--bankregion', type=trfArgClasses.argFactory(trfArgClasses.argIntList, runarg=True),
                        help='Bank region number', group='TrigFTKSim', nargs='+')
    parser.add_argument('--bankpatterns', type=trfArgClasses.argFactory(trfArgClasses.argIntList, runarg=True),
                        help='Number of bank patterns', group='TrigFTKSim', nargs='+')
    parser.add_argument('--SetAMSize',type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='This variable decides how to set the limit on the number of patterns: 0 TSP, 1 or 2 AM (as soon as limit reached, before exceeded)',
                        group='TrigFTKSim')
    parser.add_argument('--SecondStageFit', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help="Enables the second stage fitter", group='TrigFTKSim')
    parser.add_argument('--doAuxFW', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help="Enables firmware-style constants", group='TrigFTKSim')
    parser.add_argument('--PrintSSBConstants', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help="Prints hardware-style SSB constants", group='TrigFTKSim')
    parser.add_argument('--MaxNcomb', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help="Limit on the number of combinations per road", group='TrigFTKSim')
    parser.add_argument('--MaxNhitsPerPlane', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help="limit the number of hits per plane per road", group='TrigFTKSim')

    parser.add_argument('--TRACKFITTER_MODE', type=trfArgClasses.argFactory(trfArgClasses.argIntList, runarg=True),
                        help='track fitter mode', group='TrigFTKSim', nargs='+')
    parser.add_argument('--SSFMultiConnection', type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help='Flag to enable the multi-connections mode in the SSF', group='TrigFTKSim')
    parser.add_argument('--SSFNConnections', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='Maximum number of connections in the SSF', group='TrigFTKSim')
    parser.add_argument('--SSFAllowExtraMiss', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='Allowing extra missed layer in the transition region', group='TrigFTKSim')
    parser.add_argument('--SSFTRDefn', type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='How the transition region is defined: 0=moduleID of last SCT layer, 1=by eta of 1st stage track', group='TrigFTKSim')
    parser.add_argument('--SSFTRMinEta', type=trfArgClasses.argFactory(trfArgClasses.argFloat, runarg=True),
                        help='when SSFTRDefn=1 (by eta), the min eta', group='TrigFTKSim')
    parser.add_argument('--SSFTRMaxEta', type=trfArgClasses.argFactory(trfArgClasses.argFloat, runarg=True),
                        help='when SSFTRDefn=1 (by eta), the max eta', group='TrigFTKSim')
    #JDC:
    parser.add_argument('--ConstantsDir', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Directory where input files are kept', group='TrigFTKSim')
    parser.add_argument('--FitConstantsVersion', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Version of fit constants', group='TrigFTKSim')
    parser.add_argument('--PatternsVersion', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Version of patterns', group='TrigFTKSim')
    parser.add_argument('--separateSubRegFitConst', default=0, type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='Use separate fit constant for each subregion', group='TrigFTKSim')
    parser.add_argument('--useDBPath', default=0, type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='Query the Data Base to get File Paths', group='TrigFTKSim')
    parser.add_argument('--runNum', default=0, type=trfArgClasses.argFactory(trfArgClasses.argInt, runarg=True),
                        help='Run Number', group='TrigFTKSim')
    parser.add_argument('--versionTag', default=0, type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='COOL tag for a different version', group='TrigFTKSim')
    #end JDC

    # Add named parameters for each subregion
    for subregion in range(subregions):
        parser.add_argument('--patternbank{0}path'.format(subregion), type=trfArgClasses.argFactory(trfArgClasses.argList, runarg=True),
                            help='Pattern bank path file, subregion {0}'.format(subregion), group='TrigFTKSim', nargs='+')
        parser.add_argument('--fitconstants{0}path'.format(subregion), type=trfArgClasses.argFactory(trfArgClasses.argList, runarg=True),
                            help='Fit-constants path file, subregion {0}'.format(subregion), group='TrigFTKSim', nargs='+')
        parser.add_argument('--fit711constants{0}path'.format(subregion), type=trfArgClasses.argFactory(trfArgClasses.argList, runarg=True),
                            help='Fit-constants second stage path file, subregion {0}'.format(subregion), group='TrigFTKSim', nargs='+')
        parser.add_argument('--sector{0}path'.format(subregion), type=trfArgClasses.argFactory(trfArgClasses.argList, runarg=True),
                            help='sectors path file, subregion {0}'.format(subregion), group='TrigFTKSim', nargs='+')


    parser.add_argument('--FTKSetupTag', type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Setup the FTK architecture tag, if specific values are also used they have priority', group='TrigFTKSim')

    parser.defineArgGroup('TrigFTKMerge', 'Fast tracker simulation merge options')

    # File handling
    parser.add_argument('--inputRDOFile', nargs='+',
                        type=trfArgClasses.argFactory(trfArgClasses.argPOOLFile, io='input', runarg=True, type='rdo'),
                        help='Input RDO file', group='TrigFTKSim')
    parser.add_argument('--inputNTUP_FTKIPFile',
                        type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True, io='input', type='ntup_ftkiptmp', treeNames='ftkhits'),
                        help='FTK RDO file in ROOT format', group='TrigFTKSim', nargs='+')
    parser.add_argument('--inputTXT_FTKIPFile',
                        type=trfArgClasses.argFactory(trfArgClasses.argFTKIPFile, runarg=True, io='input', type='txt_ftkip'),
                        help='Wrapper files (in .dat.bz2 format)', group='TrigFTKSim', nargs='+')
    parser.add_argument('--outputNTUP_FTKTMPFile', '--outputNTUP_FTKFile',
                        type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True, io='output', type='ntup_ftk', treeNames='ftkdata'),
                        help='Subregion merged FTK file', group='TrigFTKMerge',nargs='+')

    # The following for testing only
    for subregion in range(subregions):
        parser.add_argument('--inputNTUP_FTKTMP_{0}File'.format(subregion),
                        type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True, io='input', type='ntup_ftkiptmp', treeNames='ftkdata'),
                        help='FTK NTUP file from subregion {0} (for testing only)'.format(subregion), group='TrigFTKSim', nargs='+')
        parser.add_argument('--outputNTUP_FTKTMP_{0}File'.format(subregion),
                        type=trfArgClasses.argFactory(trfArgClasses.argNTUPFile, runarg=True, io='output', type='ntup_ftkiptmp', treeNames='ftkdata'),
                        help='FTK NTUP file from subregion {0} (for testing only)'.format(subregion), group='TrigFTKSim', nargs='+')


    parser.add_argument('--FTKUnmergedInputPath',
                        type=trfArgClasses.argFactory(trfArgClasses.argString, runarg=True),
                        help='Unmerged Input file path', group='TrigFTKMerge')

    parser.add_argument('--FTKForceAllInput',
                        type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help='Force all Input files to be present', group='TrigFTKMerge')

    parser.add_argument('--FTKDoGrid',
                        type=trfArgClasses.argFactory(trfArgClasses.argBool, runarg=True),
                        help='Use the naming for the grid input', group='TrigFTKMerge')