Skip to content
Snippets Groups Projects
Forked from faser / calypso
1075 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ScintDigiAlgsConfig.py 1.84 KiB
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory

from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg


# One stop shopping for normal FASER data
def ScintWaveformDigitizationCfg(flags):
    """ Return all algorithms and tools for Waveform digitization """
    acc = ComponentAccumulator()

    if not flags.Input.isMC:
        return

    if "TB" not in flags.GeoModel.FaserVersion:
        acc.merge(ScintWaveformDigiCfg(flags, "TimingWaveformDigiAlg", "Trigger"))
    acc.merge(ScintWaveformDigiCfg(flags, "VetoWaveformDigiAlg", "Veto"))
    acc.merge(ScintWaveformDigiCfg(flags, "PreshowerWaveformDigiAlg", "Preshower"))
    return acc

# Return configured digitization algorithm from SIM hits
# Specify data source (Veto, Trigger, Preshower)
def ScintWaveformDigiCfg(flags, name="ScintWaveformDigiAlg", source="", **kwargs):

    acc = ComponentAccumulator()

    tool = CompFactory.WaveformDigitisationTool(name=source+"WaveformDigtisationTool", **kwargs)
    
    kwargs.setdefault("ScintHitContainerKey", source+"Hits")
    kwargs.setdefault("WaveformContainerKey", source+"Waveforms")

    digiAlg = CompFactory.ScintWaveformDigiAlg(name, **kwargs)
    digiAlg.CB_alpha = -0.32275
    digiAlg.CB_n = 65
    digiAlg.CB_mean = 846.55
    digiAlg.CB_sigma = 5.372
    
    kwargs.setdefault("WaveformDigitisationTool", tool)

    acc.addEventAlgo(digiAlg)

    return acc

def ScintWaveformDigitizationOutputCfg(flags, **kwargs):
    """ Return ComponentAccumulator with output for Waveform Digi"""
    acc = ComponentAccumulator()
    ItemList = [
        "RawWaveformContainer#*"
    ]
    acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
    # ostream = acc.getEventAlgo("OutputStreamRDO")
    # ostream.TakeItemsFromInput = True # Don't know what this does
    return acc