コード例 #1
0
    def configure(self):
        mlog = logging.getLogger( 'Py:LArRawChannelGetter::configure %s:' % self.__class__ )

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        from AthenaCommon.AppMgr import ToolSvc


        # get LArDigitGetter in MC case
        from AthenaCommon.DetFlags import DetFlags
        if DetFlags.digitize.LAr_on() :
            try:
                from LArDigitization.LArDigitGetter import LArDigitGetter
                theLArDigitGetter = LArDigitGetter()
            except Exception as configException:
                mlog.error("could not get handle to LArDigitGetter Quit")
                import traceback
                mlog.error(traceback.format_exc())
                return False
            if not theLArDigitGetter.usable():
                mlog.error("LArDigitGetter unusable. Quite")
                return False

        from LArROD.LArRODFlags import larRODFlags

        from AthenaCommon.GlobalFlags import globalflags
        if globalflags.DataSource()=='data' or larRODFlags.forceIter() :

            # ADC2MeV tool
            from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
            theADC2MeVTool = LArADC2MeVToolDefault()
            ToolSvc += theADC2MeVTool


            from AthenaCommon.AppMgr import ServiceMgr as svcMgr

# Data case

            if larRODFlags.readDigits():

                from AthenaCommon.GlobalFlags import globalflags
                if globalflags.InputFormat() == 'bytestream':
                    if not larRODFlags.keepDSPRaw():
                        topSequence.LArRawDataReaderAlg.LArRawChannelKey=""

                if globalflags.DetGeo() == 'ctbh6' or globalflags.DetGeo() == 'ctbh8':        
                    from LArROD.LArRODConf import LArRawChannelBuilder
                    theLArRawChannelBuilder=LArRawChannelBuilder()
                    topSequence += theLArRawChannelBuilder
                    return True

                from LArROD.LArRODConf import LArRawChannelBuilderDriver

                theLArRawChannelBuilder=LArRawChannelBuilderDriver("LArRawChannelBuilder")
                topSequence += theLArRawChannelBuilder

                if larRODFlags.keepDSPRaw():
                    theLArRawChannelBuilder.LArRawChannelContainerName=larRODFlags.RawChannelFromDigitsContainerName()

                # bad channel masking if required
                if not larRODFlags.doBuildBadChannel():
                    # The first tool filters out bad channels
                    from LArROD.LArRODConf import LArRawChannelBuilderToolBadChannelTool
                    theLArRawChannelBuilderToolBadChannel=LArRawChannelBuilderToolBadChannelTool()
                    from LArBadChannelTool.LArBadChannelToolConf import LArBadChannelMasker
                    theLArRCBMasker=LArBadChannelMasker("LArRCBMasker")
                    theLArRCBMasker.DoMasking=True
                    theLArRCBMasker.ProblemsToMask=[
                       "deadReadout","deadPhys","almostDead","short",
                       "lowNoiseHG","highNoiseHG","unstableNoiseHG",
                       "lowNoiseMG","highNoiseMG","unstableNoiseMG",
                       "lowNoiseLG","highNoiseLG","unstableNoiseLG"
                      ]
                    theLArRawChannelBuilderToolBadChannel.BadChannelMask=theLArRCBMasker
                    theLArRawChannelBuilder.BuilderTools += [theLArRawChannelBuilderToolBadChannel]
                    ToolSvc+=theLArRawChannelBuilderToolBadChannel

               
                # Pulse reconstruction
                # main method: OFC iteration
                from LArROD.LArRODConf import LArRawChannelBuilderToolOFCIter
                theLArRawChannelBuilderToolOFCIter=LArRawChannelBuilderToolOFCIter()
                theLArRawChannelBuilderToolOFCIter.minSample = 2
                theLArRawChannelBuilderToolOFCIter.maxSample = 12
                theLArRawChannelBuilderToolOFCIter.minADCforIterInSigma=4 # ADCmax at least 4 sigma above noise for iteration
                theLArRawChannelBuilderToolOFCIter.minADCforIter=15 # min adc for iteration (only if no pedestalRMS found)
                theLArRawChannelBuilderToolOFCIter.defaultPhase=0    # starting delay, also the fixed delay for ADC below min.
                theLArRawChannelBuilderToolOFCIter.ECut=250.         # Energy to save quality
                theLArRawChannelBuilder.BuilderTools += [theLArRawChannelBuilderToolOFCIter]
                theLArRawChannelBuilder+=theLArRawChannelBuilderToolOFCIter 

                # no fallback when emulating exactly DSP computation
                if not larRODFlags.doDSP():
                    # fallback(1): cubic method
                    from LArROD.LArRODConf import LArRawChannelBuilderToolCubic
                    theLArRawChannelBuilderToolCubic=LArRawChannelBuilderToolCubic()
                    theLArRawChannelBuilderToolCubic.minADCforCubic=30 
                    theLArRawChannelBuilder.BuilderTools  += [theLArRawChannelBuilderToolCubic]
                    theLArRawChannelBuilder += theLArRawChannelBuilderToolCubic 

                    # fallback(2) averageing
                    from LArROD.LArRODConf import LArRawChannelBuilderToolAverage
                    theLArRawChannelBuilderToolAverage=LArRawChannelBuilderToolAverage()
                    theLArRawChannelBuilderToolAverage.NScan=0
                    theLArRawChannelBuilder.BuilderTools  += [theLArRawChannelBuilderToolAverage]
                    theLArRawChannelBuilder += theLArRawChannelBuilderToolAverage 


                # Pedestal
                # main method from database
                from LArROD.LArRODConf import LArRawChannelBuilderPedestalDataBase
                theLArRawChannelBuilderPedestalDataBase=LArRawChannelBuilderPedestalDataBase()
                theLArRawChannelBuilderPedestalDataBase.LArPedestalKey = "LArPedestal"
                theLArRawChannelBuilder.PedestalTools  = [theLArRawChannelBuilderPedestalDataBase]
                theLArRawChannelBuilder += theLArRawChannelBuilderPedestalDataBase 
                
                # no fallback when emulating exactly DSP computation
                if not larRODFlags.doDSP():
                    # fallback. sample 0
                    from LArROD.LArRODConf import LArRawChannelBuilderPedestalSampleZero
                    theLArRawChannelBuilderPedestalSampleZero=LArRawChannelBuilderPedestalSampleZero()
                    theLArRawChannelBuilder.PedestalTools  += [theLArRawChannelBuilderPedestalSampleZero]
                    theLArRawChannelBuilder += theLArRawChannelBuilderPedestalSampleZero

                # ADC to energy
                # main method from database
                from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase
                theLArRawChannelBuilderADC2EDataBase=LArRawChannelBuilderADC2EDataBase()
                theLArRawChannelBuilder.ADCtoEnergyTools  = [theLArRawChannelBuilderADC2EDataBase]
                theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theADC2MeVTool
                theLArRawChannelBuilder += theLArRawChannelBuilderADC2EDataBase 

                # no fallback when emulating exactly DSP computation
                if not larRODFlags.doDSP():
                    # fallback, constant conversion factors
                    from LArROD.LArRODConf import LArRawChannelBuilderADC2EConstants
                    theLArRawChannelBuilderADC2EConstants=LArRawChannelBuilderADC2EConstants()
                    theLArRawChannelBuilder.ADCtoEnergyTools += [theLArRawChannelBuilderADC2EConstants]
                    theLArRawChannelBuilder += theLArRawChannelBuilderADC2EConstants

                #more tools to be configured
                from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
                theLArOFPeakRecoTool=LArOFPeakRecoTool()
                from LArConditionsCommon.LArCondFlags import larCondFlags
                theLArOFPeakRecoTool.UseShape=larCondFlags.useShape()
                if larCondFlags.LArCoolChannelSelection.statusOn:
                    if len(larCondFlags.LArCoolChannelSelection())>0:
                        theLArOFPeakRecoTool.forceHighGain=larCondFlags.useOFCOnlyCoolChannelSelection()
                ToolSvc += theLArOFPeakRecoTool

                #
                # adjust default timing to match first sample information written in cool from Lar online configuration
                #
                nominalPeakSample=2
                if globalflags.DataSource()=='data':
                    from LArConditionsCommon.LArCool import larcool
                    if (larcool is not None):
                        nominalPeakSample = larcool.firstSample()
                        # don't use ramp intercept in calibration if gain type is not auto
                        if larcool.gainType() > 0 :
                            mlog.info(" Gain Type: %d  don't use intercept in ADC to Energy ramp calibration",larcool.gainType())
                            theLArRawChannelBuilderADC2EDataBase.UseHighGainRampIntercept = False
                            theLArRawChannelBuilderADC2EDataBase.UseMedGainRampIntercept = False
                            theLArRawChannelBuilderADC2EDataBase.UseLowGainRampIntercept = False
                        else :
                             mlog.info(" Gain Type: %d   use intercept in ADC to energy ramp calibraion ",larcool.gainType())
                if (nominalPeakSample > 1) :
                    theLArRawChannelBuilder.DefaultShiftTimeSample=nominalPeakSample-2
                else :
                    theLArRawChannelBuilder.DefaultShiftTimeSample=0
                theLArRawChannelBuilder.DataLocation    = "FREE"

            else:

                from AthenaCommon.GlobalFlags import globalflags
                if globalflags.InputFormat() == 'bytestream':
                    if not "LArRawChannelContainer/LArRawChannels" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                        svcMgr.ByteStreamAddressProviderSvc.TypeNames+=["LArRawChannelContainer/LArRawChannels"]

            # In the case of DSP monitoring and reading rawchannels, need to give a different name to the LArRawChannels container
            # read from the bytestream ...
            # This name has to be coherent with the name in LArMonTools/LArRODMonTool_jobOptions.py
            if larRODFlags.doDSP() and larRODFlags.readRawChannels():  #Reading LArRawChannel
                print ("Reading RawChannels in DSP physics mode")
                # !!! The name of the LArRawChannels container read from the Bytestream is LArRawChannels_fB !!!
                if not "LArRawChannelContainer/LArRawChannels_fB" in svcMgr.ByteStreamAddressProviderSvc.TypeNames:
                    svcMgr.ByteStreamAddressProviderSvc.TypeNames+=["LArRawChannelContainer/LArRawChannels_fB"]
                print (svcMgr.ByteStreamAddressProviderSvc.TypeNames)
      
        else:

            # MC Case
            try:
                from AthenaCommon import CfgGetter
                topSequence += CfgGetter.getAlgorithm("LArRawChannelBuilder", tryDefaultConfigurable=True)
            except Exception as cfgException:
                mlog.error("Failed to retrieve LArRawChannelBuilder. Quit")
                import traceback
                mlog.error(traceback.format_exc())
                return False

        return True
コード例 #2
0
theLArRCBMasker.DoMasking = True
theLArRCBMasker.ProblemsToMask = [
    "deadCalib", "deadReadout", "deadPhys", "almostDead", "short"
]
ToolSvc += theLArRCBMasker

from LArCalibUtils.LArCalibUtilsConf import LArRampBuilder
theLArRampBuilder = LArRampBuilder()
theLArRampBuilder.KeyList = GainList
theLArRampBuilder.SubtractDac0 = False
theLArRampBuilder.BadChannelMask = theLArRCBMasker

if (PeakOF):
    theLArRampBuilder.RecoType = "OF"
    from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
    theLArOFPeakRecoTool = LArOFPeakRecoTool()
    theLArOFPeakRecoTool.UseShape = False
    ToolSvc += theLArOFPeakRecoTool
else:
    theLArRampBuilder.RecoType = "Parabola"
    from LArRecUtils.LArRecUtilsConf import LArParabolaPeakRecoTool
    theLArParabolaPeakRecoTool = LArParabolaPeakRecoTool()
    theLArParabolaPeakRecoTool.correctBias = CorrectBias
    ToolSvc += theLArParabolaPeakRecoTool

# As the first ramp point no longer is taken at DAC=0
# this point should not have a special place.
theLArRampBuilder.DAC0 = -1
theLArRampBuilder.StoreRawRamp = SaveRawRamp
theLArRampBuilder.StoreRecRamp = True
theLArRampBuilder.Polynom = 1
コード例 #3
0
ToolSvc += theLArRawChannelBuilderPedestalDataBase

from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
theLArADC2MeVTool = LArADC2MeVToolDefault()
ToolSvc += theLArADC2MeVTool

from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase
theLArRawChannelBuilderADC2EDataBase = LArRawChannelBuilderADC2EDataBase()
theLArRawChannelBuilder.ADCtoEnergyTools = [
    theLArRawChannelBuilderADC2EDataBase.getFullName()
]
theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theLArADC2MeVTool
ToolSvc += theLArRawChannelBuilderADC2EDataBase

from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
theLArOFPeakRecoTool = LArOFPeakRecoTool()
theLArOFPeakRecoTool.UseShape = False  #Shoudl eventually be switched to true
ToolSvc += theLArOFPeakRecoTool

#Setting up the CBNTAA
from CBNT_Athena.CBNT_AthenaAwareCfg import CBNT_AthenaAware
theCBNT_AthenaAware = CBNT_AthenaAware()
CBNT_AthenaAware = topSequence.CBNT_AthenaAware
include("CBNT_Athena/CBNT_EventInfo_jobOptions.py")

from LArROD.LArRODConf import CBNTAA_LArDigits
theCBNTAA_LArDigits = CBNTAA_LArDigits("CBNTAA_LArDigits")
theCBNTAA_LArDigits.MaxChannels = 200000
#theCBNTAA_LArDigits.NEvents=1000
theCBNTAA_LArDigits.DumpIterResults = True
theCBNTAA_LArDigits.SaveId = True
コード例 #4
0
        )
        theLArRawChannelBuilderPedestalDataBase.LArPedestalKey = "Pedestal"
        # ADC to energy
        # Some other tool before
        from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
        theADC2MeVTool = LArADC2MeVToolDefault()
        ToolSvc += theADC2MeVTool

        # main method from database
        from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase
        theLArRawChannelBuilderADC2EDataBase = LArRawChannelBuilderADC2EDataBase(
        )
        theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theADC2MeVTool
        #more tools to be configured
        from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
        theLArOFPeakRecoTool = LArOFPeakRecoTool()
        from LArConditionsCommon.LArCondFlags import larCondFlags
        theLArOFPeakRecoTool.UseShape = larCondFlags.useShape()

    ToolSvc += LArCellBuilderDriver()
    t2 = LArRawChannelBuilderToolCubic()
    t3 = LArRawChannelBuilderToolAverage()
    t5 = LArRawChannelBuilderADC2EConstants()
    t6 = LArRawChannelBuilderPedestalSampleZero()

    if dbon:
        TheToolList = [theLArRawChannelBuilderToolOFCIter, t2, t3]
        ToolSvc += theLArRawChannelBuilderPedestalDataBase
        ToolSvc += theLArRawChannelBuilderADC2EDataBase
        ToolSvc.LArCellBuilderDriver.DefaultShiftTimeSample = 1
        ToolSvc.LArCellBuilderDriver.DataLocation = "FREE"
コード例 #5
0
theLArRawChannelBuilder += theLArRawChannelBuilderPedestalDataBase

from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
theLArADC2MeVTool = LArADC2MeVToolDefault()
ToolSvc += theLArADC2MeVTool

from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase
theLArRawChannelBuilderADC2EDataBase = LArRawChannelBuilderADC2EDataBase()
theLArRawChannelBuilder.ADCtoEnergyTools = [
    theLArRawChannelBuilderADC2EDataBase
]
theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theLArADC2MeVTool
theLArRawChannelBuilder += theLArRawChannelBuilderADC2EDataBase

from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
theLArOFPeakRecoTool = LArOFPeakRecoTool()
theLArOFPeakRecoTool.UseShape = True
ToolSvc += theLArOFPeakRecoTool

#"ESD" writing
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
StreamESD_Augmented = MSMgr.NewPoolStream("streamESD",
                                          "esdout.pool.root",
                                          asAlg=True)
StreamESD = StreamESD_Augmented.GetEventStream()
StreamESD.ItemList += ["EventInfo#*", "LArRawChannelContainer#*"]

#CaloD3PD writing
from CaloD3PDMaker.LArDigitD3PDObject import LArDigitD3PDObject
from EventCommonD3PDMaker.EventInfoD3PDObject import EventInfoD3PDObject
alg = MSMgr.NewRootStream("caloD3PD", CafJobOutputs[0])
コード例 #6
0
if not 'LArDigitKey' in dir():
    LArDigitKey="LArDigitContainer_MC"

if not 'LArRawChannelKey' in dir():
    LArRawChannelKey="LArRawChannels"

MCFlag = GlobalFlags.DataSource.is_geant4()

if MCFlag :
    PedestalKey = "LArPedestal"
else:
    PedestalKey = "Pedestal"    

#more tools to be configured
from LArRecUtils.LArRecUtilsConf import LArOFPeakRecoTool
theLArOFPeakRecoTool=LArOFPeakRecoTool()
theLArOFPeakRecoTool.KeyShape="LArShape"
theLArOFPeakRecoTool.UseShape=False
ToolSvc += theLArOFPeakRecoTool

if MCFlag :
	from LArRecUtils.LArOFCToolDefault import LArOFCToolDefault
	theLArOFCTool=LArOFCToolDefault()
	ToolSvc += theLArOFCTool
    
from LArRecUtils.LArADC2MeVToolDefault import LArADC2MeVToolDefault
theLArADC2MeVTool=LArADC2MeVToolDefault()
ToolSvc+=theLArADC2MeVTool

from LArROD.LArRODConf import *