Beispiel #1
0
def LArAutoCorrTotalCondAlgDefault():

    mlog = logging.getLogger( 'LArAutoCorrTotalCondAlg::__init__ ' )
    mlog.info("entering LArAutoCorrTotalCondAlgDefault")

    LArOnOffIdMapping()
    condSeq = AthSequencer("AthCondSeq")
    if hasattr (condSeq,"LArAutoCorrTotalCondAlg"):
        return getattr(condSeq,"LArAutoCorrTotalCondAlg")

    theAutoCorrTotalCondAlg=LArAutoCorrTotalCondAlg()


    from AthenaCommon.BeamFlags import jobproperties
    from LArROD.LArRODFlags import larRODFlags

    from AthenaCommon.SystemOfUnits import ns
    theAutoCorrTotalCondAlg.Nsamples = larRODFlags.nSamples()
    theAutoCorrTotalCondAlg.firstSample = larRODFlags.firstSample()
    theAutoCorrTotalCondAlg.deltaBunch = int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5)   

    if larRODFlags.doOFCPileupOptimization():
        if larRODFlags.NumberOfCollisions():
            theAutoCorrTotalCondAlg.Nminbias=larRODFlags.NumberOfCollisions()
            mlog.info("  setup for  Ncollisions %f   deltaBunch %f", larRODFlags.NumberOfCollisions(), jobproperties.Beam.bunchSpacing())
        else:
            theAutoCorrTotalCondAlg.Nminbias=jobproperties.Beam.numberOfCollisions()
            mlog.info("  setup for  Ncollisions %f   deltaBunch %f", jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing())
    else:
        theAutoCorrTotalCondAlg.Nminbias=0
        mlog.info("  setup for computing total noise autocorrelation without pileup")
    
 
    condSeq+=theAutoCorrTotalCondAlg
    return theAutoCorrTotalCondAlg
def LArAutoCorrNoiseSCToolDefault(name="LArAutoCorrNoiseSCToolDefault", **kw):
    # call base class constructor
    from AthenaCommon import CfgMgr
    kw['name'] = name
    tool = CfgMgr.LArAutoCorrNoiseTool(**kw)

    mlog = logging.getLogger('LArAutoCorrNoiseSCToolDefault::__init__ ')
    mlog.info("entering")

    # do the configuration
    tool.MCSym = False
    tool.SuperCell = True
    tool.keyAutoCorr = "LArAutoCorrSC"

    from LArROD.LArRODFlags import larRODFlags
    tool.NSamples = larRODFlags.nSamples()
    from IOVDbSvc.CondDB import conddb
    if (conddb.isMC and
            not conddb.folderRequested('/LAR/IdentifierOfl/OnOffIdMap_SC')):
        conddb.addFolder(
            "LAR_OFL",
            "<tag>LARIdentifierOflOnOffIdMap_SC-000</tag>/LAR/IdentifierOfl/OnOffIdMap_SC"
        )
    if (conddb.isMC
            and not conddb.folderRequested('/LAR/ElecCalibMCSC/AutoCorr')):
        conddb.addFolder(
            "LAR_OFL",
            "<tag>LARElecCalibMCSCAutoCorr-000</tag>/LAR/ElecCalibMCSC/AutoCorr"
        )

    return tool
Beispiel #3
0
def LArAutoCorrTotalToolDefault(name="LArAutoCorrTotalToolDefault", **kw):
    # call base class constructor
    from AthenaCommon import CfgMgr
    kw['name'] = name
    tool = CfgMgr.LArAutoCorrTotalTool(**kw)

    mlog = logging.getLogger('LArAutoCorrTotalToolDefault::__init__ ')
    mlog.info("entering")

    # do the configuration
    if globalflags.DataSource() == 'data':
        tool.MCSym = False
        tool.IsMC = False
        tool.keyPedestal = "Pedestal"
    else:
        tool.MCSym = True
        tool.IsMC = True

    from AthenaCommon.BeamFlags import jobproperties
    tool.deltaBunch = int(jobproperties.Beam.bunchSpacing() / (25. * ns) + 0.5)

    from LArROD.LArRODFlags import larRODFlags
    if larRODFlags.doOFCMixedOptimization():
        tool.UseMixedOFCOpt = True
        tool.NMinBias = jobproperties.Beam.numberOfCollisions()
        mlog.info(
            "  setup for  Ncollisions %f   deltaBunch %f and OFC *MIXED* optimization"
            % (jobproperties.Beam.numberOfCollisions(),
               jobproperties.Beam.bunchSpacing()))
    else:
        if larRODFlags.doOFCPileupOptimization():
            if larRODFlags.NumberOfCollisions():
                tool.NMinBias = larRODFlags.NumberOfCollisions()
                mlog.info("  setup for  Ncollisions %f   deltaBunch %f" %
                          (larRODFlags.NumberOfCollisions(),
                           jobproperties.Beam.bunchSpacing()))
            else:
                tool.NMinBias = jobproperties.Beam.numberOfCollisions()
                mlog.info("  setup for  Ncollisions %f   deltaBunch %f" %
                          (jobproperties.Beam.numberOfCollisions(),
                           jobproperties.Beam.bunchSpacing()))
        else:
            tool.NMinBias = 0
            mlog.info(
                "  setup for computing total noise autocorrelation without pileup"
            )

    tool.NSamples = larRODFlags.nSamples()
    tool.firstSample = larRODFlags.firstSample()

    from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
    theADC2MeVTool = LArADC2MeVToolDefault()
    from AthenaCommon.AppMgr import ToolSvc
    ToolSvc += theADC2MeVTool
    tool.ADC2MeVTool = theADC2MeVTool
    return tool
Beispiel #4
0
def LArAutoCorrNoiseCondAlgDefault():

    LArOnOffIdMapping()
    LArMCSymCondAlgDefault()
    condSeq = AthSequencer("AthCondSeq")
    if hasattr(condSeq, "LArAutoCorrNoiseCondAlg"):
        return getattr(condSeq, "LArAutoCorrNoiseCondAlg")

    theAutoCorrNoiseCondAlg = LArAutoCorrNoiseCondAlg(
        "LArAutoCorrNoiseCondAlg")

    from LArROD.LArRODFlags import larRODFlags
    theAutoCorrNoiseCondAlg.nSampl = larRODFlags.nSamples()

    condSeq += theAutoCorrNoiseCondAlg
    return theAutoCorrNoiseCondAlg
Beispiel #5
0
def LArAutoCorrNoiseToolDefault (name="LArAutoCorrNoiseToolDefault", **kw): 
    # call base class constructor
    from AthenaCommon import CfgMgr
    kw['name'] = name
    tool = CfgMgr.LArAutoCorrNoiseTool (**kw)

    mlog = logging.getLogger( 'LArAutoCorrNoiseToolDefault::__init__ ' )
    mlog.info("entering")
    mlog.warning("The LArAutoCorrNoiseToolDefault is depricated. Please use LArAutoCorrNoiseCondAlg")
    # do the configuration
    if globalflags.DataSource()=='data':
        tool.MCSym = False
    else:
        tool.MCSym = True

    from LArROD.LArRODFlags import larRODFlags
    tool.NSamples = larRODFlags.nSamples()

    return tool
Beispiel #6
0
def LArAutoCorrTotalSCToolDefault (name="LArAutoCorrTotalSCToolDefault", **kw):
    # call base class constructor
    from AthenaCommon import CfgMgr
    kw['name'] = name
    tool = CfgMgr.LArAutoCorrTotalTool(**kw)

    mlog = logging.getLogger( 'LArAutoCorrTotalSCToolDefault::__init__ ' )
    mlog.info("entering")

    tool.IsSuperCell = True
    # do the configuration
    if globalflags.DataSource()=='data':
        #return False
        tool.MCSym = False
        tool.IsMC  = False
    else:
        tool.MCSym = False
        tool.IsMC  = True
        tool.keyAutoCorr = "LArAutoCorrSC"
        tool.keyShape = "LArShapeSC"
        tool.keyNoise = "LArNoiseSC"
        tool.keyPedestal = "LArPedestalSC"
        tool.keyfSampl = "LARfSamplSC"

    from AthenaCommon.BeamFlags import jobproperties
    tool.deltaBunch = int(jobproperties.Beam.bunchSpacing()/( 25.*ns)+0.5)                

    from LArROD.LArRODFlags import larRODFlags
    if larRODFlags.doOFCMixedOptimization():
        tool.UseMixedOFCOpt = True
        tool.NMinBias=jobproperties.Beam.numberOfCollisions()
        print ('Number of Ncollisions : ',jobproperties.Beam.numberOfCollisions())
        mlog.info("  setup for  Ncollisions %f   deltaBunch %f and OFC *MIXED* optimization", jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing())
    else:        
        if larRODFlags.doOFCPileupOptimization():
            if larRODFlags.NumberOfCollisions():
                tool.NMinBias=larRODFlags.NumberOfCollisions()
                mlog.info("  setup for  Ncollisions %f   deltaBunch %f", larRODFlags.NumberOfCollisions(), jobproperties.Beam.bunchSpacing())
            else:
                tool.NMinBias=jobproperties.Beam.numberOfCollisions()
                mlog.info("  setup for  Ncollisions %f   deltaBunch %f", jobproperties.Beam.numberOfCollisions(), jobproperties.Beam.bunchSpacing())
        else:
            tool.NMinBias=0
            mlog.info("  setup for computing total noise autocorrelation without pileup")


    tool.NSamples = larRODFlags.nSamples()
    tool.firstSample = larRODFlags.firstSample()

    from LArRecUtils.LArADC2MeVSCToolDefault import LArADC2MeVSCToolDefault
    theADC2MeVTool = LArADC2MeVSCToolDefault()
    from AthenaCommon.AppMgr import ToolSvc
    ToolSvc += theADC2MeVTool
    tool.ADC2MeVTool = theADC2MeVTool
    if not globalflags.DataSource()=='data':
       from IOVDbSvc.CondDB import conddb
       if ( conddb.isMC and not conddb.folderRequested('/LAR/IdentifierOfl/OnOffIdMap_SC') ) :
           conddb.addFolder("LAR_OFL","<tag>LARIdentifierOflOnOffIdMap_SC-000</tag>/LAR/IdentifierOfl/OnOffIdMap_SC")
       if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/fSampl') ) :
           conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCfSampl-000</tag>/LAR/ElecCalibMCSC/fSampl")
       if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Pedestal') ) :
           conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCPedestal-000</tag>/LAR/ElecCalibMCSC/Pedestal")
       if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Noise') ) :
           conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCNoise-000</tag>/LAR/ElecCalibMCSC/Noise")
       if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/Shape') ) :
           conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCShape-000</tag>/LAR/ElecCalibMCSC/Shape")
       if ( conddb.isMC and not conddb.folderRequested('/LAR/ElecCalibMCSC/AutoCorr') ) :
           conddb.addFolder("LAR_OFL","<tag>LARElecCalibMCSCAutoCorr-000</tag>/LAR/ElecCalibMCSC/AutoCorr")
    return tool
Beispiel #7
0
def getLArPileUpTool(name='LArPileUpTool', **kwargs): ## useLArFloat()=True,isOverlay()=False,outputKey='LArDigitContainer_MC'):
    from AthenaCommon.Logging import logging
    mlog = logging.getLogger( 'LArPileUpToolDefault:' )
    mlog.info(" ---- in getLArPileUpTool " )
    # the LAr and Calo detector description package
    ## FIXME includes to be replaced by confGetter configuration.
    if not isOverlay():
        from AthenaCommon.Resilience import protectedInclude
        protectedInclude( "CaloDetMgrDetDescrCnv/CaloDetMgrDetDescrCnv_joboptions.py" )
        protectedInclude( "LArDetDescr/LArDetDescr_joboptions.py" )
        protectedInclude("LArConditionsCommon/LArConditionsCommon_MC_jobOptions.py")
    from Digitization.DigitizationFlags import digitizationFlags
    kwargs.setdefault('NoiseOnOff', digitizationFlags.doCaloNoise.get_Value() )
    kwargs.setdefault('RndmSvc', digitizationFlags.rndmSvc.get_Value() )
    digitizationFlags.rndmSeedList.addSeed("LArDigitization", 1234, 5678 )
    kwargs.setdefault('DoDigiTruthReconstruction',digitizationFlags.doDigiTruth())

    if digitizationFlags.doXingByXingPileUp():
        kwargs.setdefault('FirstXing', -751 )
        kwargs.setdefault('LastXing', 101 )

    from LArDigitization.LArDigitizationFlags import jobproperties
    # check if using high gain for Fcal or not
    if  (not jobproperties.LArDigitizationFlags.useFcalHighGain()) and (not isOverlay()):
        mlog.info("do not use high gain in Fcal digitization ")
        kwargs.setdefault('HighGainThreshFCAL', 0 )
    else:
        mlog.info("use high gain in Fcal digitization or overlay job")

    # check if using high gain for EMEC IW or not
    if (not jobproperties.LArDigitizationFlags.useEmecIwHighGain()) and (not isOverlay()):
       mlog.info("do not use high gain in EMEC IW digitization ")
       kwargs.setdefault('HighGainThreshEMECIW',0)

    kwargs.setdefault('RndmEvtOverlay', isOverlay() )
    kwargs.setdefault('DigitContainer', 'LArDigitContainer_MC' ) ##FIXME - should not be hard-coded

    # if doing MC+MC overlay
    from AthenaCommon.GlobalFlags import globalflags
    if isOverlay() and globalflags.DataSource() == 'geant4':
        kwargs.setdefault('isMcOverlay',True)

    from LArROD.LArRODFlags import larRODFlags
    kwargs.setdefault('Nsamples', larRODFlags.nSamples() )
    kwargs.setdefault('firstSample', larRODFlags.firstSample() )

    if  isOverlay() :
         kwargs.setdefault('RandomDigitContainer', 'LArDigitContainer_MC' )

    # ADC2MeVTool
    mlog.info(" ----  set LArADC2MeVToolDefault")
    kwargs.setdefault('ADC2MeVTool', 'LArADC2MeVToolDefault')

    # Tool for noise autocorrelation generation
    kwargs.setdefault('AutoCorrNoiseTool', 'LArAutoCorrNoiseToolDefault')

    # bad channel masking
    from LArBadChannelTool.LArBadChannelToolConf import LArBadChanTool
    theLArBadChannelTool=LArBadChanTool()
    from AthenaCommon.AppMgr import ToolSvc
    ToolSvc+=theLArBadChannelTool
    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
    theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
    theLArRCBMasker.TheLArBadChanTool = theLArBadChannelTool
    theLArRCBMasker.DoMasking=True
    theLArRCBMasker.ProblemsToMask=[
         "deadReadout","deadPhys"]
    ToolSvc+=theLArRCBMasker
    kwargs.setdefault('MaskingTool', theLArRCBMasker )
    kwargs.setdefault('BadChannelTool', theLArBadChannelTool )

    # CosmicTriggerTimeTool for cosmics digitization
    from AthenaCommon.BeamFlags import jobproperties
    if jobproperties.Beam.beamType == "cosmics" :
        from CommissionUtils.CommissionUtilsConf import CosmicTriggerTimeTool
        theTriggerTimeTool = CosmicTriggerTimeTool()
        ToolSvc += theTriggerTimeTool
        kwargs.setdefault('UseTriggerTime', True )
        kwargs.setdefault('TriggerTimeToolName', theTriggerTimeTool )


    # pileup configuration "algorithm" way
    if not digitizationFlags.doXingByXingPileUp():
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.pileup.LAr_on() or isOverlay():
            kwargs.setdefault('PileUp', True )

    kwargs.setdefault('useLArFloat', useLArFloat() )
    if useLArFloat():
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        from SGComps.SGCompsConf import AddressRemappingSvc
        AddressRemappingSvc = AddressRemappingSvc()
        svcMgr += AddressRemappingSvc
        from AthenaCommon.ConfigurableDb import getConfigurable
        svcMgr += getConfigurable( "ProxyProviderSvc" )()
        svcMgr.ProxyProviderSvc.ProviderNames += [ "AddressRemappingSvc" ]
        svcMgr.AddressRemappingSvc.TypeKeyOverwriteMaps = [ "LArHitContainer#LArHitEMB->LArHitFloatContainer#LArHitEMB" ,
                                                            "LArHitContainer#LArHitEMEC->LArHitFloatContainer#LArHitEMEC",
                                                            "LArHitContainer#LArHitHEC->LArHitFloatContainer#LArHitHEC",
                                                            "LArHitContainer#LArHitFCAL->LArHitFloatContainer#LArHitFCAL"]
        svcMgr.AddressRemappingSvc.ProxyDict="ActiveStoreSvc"


    return CfgMgr.LArPileUpTool(name, **kwargs)