from LArROD.LArRODConf import LArRawChannelBuilderPedestalDataBase theLArRawChannelBuilderPedestalDataBase = LArRawChannelBuilderPedestalDataBase( ) theLArRawChannelBuilderPedestalDataBase.LArPedestalKey = "Pedestal" theLArRawChannelBuilder.PedestalTools = [ theLArRawChannelBuilderPedestalDataBase.getFullName() ] 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
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
def configure(self): mlog = logging.getLogger('Py:LArSCellGetter::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 LArL1Sim.LArSCL1Getter import LArSCL1Getter theLArSCL1Getter = LArSCL1Getter() except Exception as configException: import traceback mlog.error(traceback.format_exc()) mlog.error("could not get handle to LArDigitGetter Quit") return False if not theLArSCL1Getter.usable(): mlog.error("LArSCL1Getter unusable. Quite") return False from LArROD.LArRODFlags import larRODFlags from AthenaCommon.GlobalFlags import globalflags # ADC2MeV tool from LArRecUtils.LArADC2MeVSCToolDefault import LArADC2MeVSCToolDefault theADC2MeVSCTool = LArADC2MeVSCToolDefault('LArADC2MeVSCTool') ToolSvc += theADC2MeVSCTool from AthenaCommon.AppMgr import ServiceMgr as svcMgr # Only MC case if True: from LArROD.LArRODConf import LArSuperCellBuilderDriver theLArSCellBuilder = LArSuperCellBuilderDriver( "LArSuperCellBuilder") theLArSCellBuilder.LArRawChannelContainerName = "LArSuperCells" theLArSCellBuilder.DataLocation = "LArDigitSCL1" self_LArSCellBuilder = theLArSCellBuilder topSequence += theLArSCellBuilder from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc if not hasattr(svcMgr, "LArFlatConditionSvc"): svcMgr += LArFlatConditionSvc() svcMgr.ProxyProviderSvc.ProviderNames += [ "LArFlatConditionSvc" ] svcMgr.LArFlatConditionSvc.DoSuperCells = True # Pulse reconstruction # main method: OFC iteration from LArRecUtils.LArOFCSCToolDefault import LArOFCSCToolDefault theLArOFCSCTool = LArOFCSCToolDefault('LArOFCSCToolDefault') ToolSvc += theLArOFCSCTool from LArROD.LArRODConf import LArRawChannelBuilderToolOFC theLArRawChannelBuilderToolOFC = LArRawChannelBuilderToolOFC( 'LArRawChannelBuilderSCToolOFC') theLArRawChannelBuilderToolOFC.OFCTool = theLArOFCSCTool theLArRawChannelBuilderToolOFC.ECut = -99999.0 theLArRawChannelBuilderToolOFC.KeyShape = "LArShapeSC" ToolSvc += theLArRawChannelBuilderToolOFC theLArSCellBuilder.BuilderTools += [theLArRawChannelBuilderToolOFC] theLArSCellBuilder += theLArRawChannelBuilderToolOFC # no fallback when emulating exactly DSP computation # fallback(1): cubic method from LArROD.LArRODConf import LArRawChannelBuilderToolCubic theLArRawChannelBuilderToolCubic = LArRawChannelBuilderToolCubic( 'LArRawChannelBuilderSCToolCubic') theLArRawChannelBuilderToolCubic.minADCforCubic = 2 ToolSvc += theLArRawChannelBuilderToolCubic theLArSCellBuilder.BuilderTools += [ theLArRawChannelBuilderToolCubic ] theLArSCellBuilder += theLArRawChannelBuilderToolCubic # Pedestal # main method from database from LArROD.LArRODConf import LArRawChannelBuilderPedestalDataBase theLArRawChannelBuilderPedestalDataBase = LArRawChannelBuilderPedestalDataBase( 'LArRawChannelBuilderPedestalSCDataBase') theLArRawChannelBuilderPedestalDataBase.LArPedestalKey = "LArPedestalSC" ToolSvc += theLArRawChannelBuilderPedestalDataBase theLArSCellBuilder.PedestalTools = [ theLArRawChannelBuilderPedestalDataBase ] theLArSCellBuilder += theLArRawChannelBuilderPedestalDataBase # no fallback when emulating exactly DSP computation # fallback. sample 0 from LArROD.LArRODConf import LArRawChannelBuilderPedestalSampleZero theLArRawChannelBuilderPedestalSampleZero = LArRawChannelBuilderPedestalSampleZero( ) ToolSvc += theLArRawChannelBuilderPedestalSampleZero theLArSCellBuilder.PedestalTools += [ theLArRawChannelBuilderPedestalSampleZero ] theLArSCellBuilder += theLArRawChannelBuilderPedestalSampleZero # ADC to energy # main method from database from LArROD.LArRODConf import LArRawChannelBuilderADC2EDataBase theLArRawChannelBuilderADC2EDataBase = LArRawChannelBuilderADC2EDataBase( name='LArRawChannelBuilderADC2ESCDataBase', IsSuperCell=True) theLArRawChannelBuilderADC2EDataBase.RampMaxHighGain = 6000 theLArRawChannelBuilderADC2EDataBase.RampMaxMediumGain = 49000 ToolSvc += theLArRawChannelBuilderADC2EDataBase theLArSCellBuilder.ADCtoEnergyTools = [ theLArRawChannelBuilderADC2EDataBase ] theLArRawChannelBuilderADC2EDataBase.ADC2MeVTool = theADC2MeVSCTool theLArSCellBuilder += theLArRawChannelBuilderADC2EDataBase # no fallback when emulating exactly DSP computation # fallback, constant conversion factors from LArROD.LArRODConf import LArRawChannelBuilderADC2EConstants theLArRawChannelBuilderADC2EConstants = LArRawChannelBuilderADC2EConstants( ) ToolSvc += theLArRawChannelBuilderADC2EConstants theLArSCellBuilder.ADCtoEnergyTools += [ theLArRawChannelBuilderADC2EConstants ] theLArSCellBuilder += theLArRawChannelBuilderADC2EConstants return True