Skip to content
Snippets Groups Projects
Commit 42ffc23f authored by Dave Casper's avatar Dave Casper
Browse files

Compatibility changes for waveform digi

parent 1ce132e1
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2020-2021 CERN for the benefit of the FASER collaboration
from re import VERBOSE
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
......@@ -12,9 +13,10 @@ def CaloWaveformDigitizationCfg(flags):
acc = ComponentAccumulator()
if not flags.Input.isMC:
return
return acc
acc.merge(CaloWaveformDigiCfg(flags, "CaloWaveformDigiAlg"))
acc.merge(CaloWaveformDigitizationOutputCfg(flags))
return acc
# Return configured digitization algorithm from SIM hits
......@@ -46,7 +48,8 @@ def CaloWaveformDigitizationOutputCfg(flags, **kwargs):
ItemList = [
"RawWaveformContainer#*"
]
acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
# ostream = acc.getEventAlgo("OutputStreamRDO")
# ostream.TakeItemsFromInput = True # Don't know what this does
acc.merge(OutputStreamCfg(flags, "RDO"))
ostream = acc.getEventAlgo("OutputStreamRDO")
ostream.TakeItemsFromInput = True # Copies all data from input file to output
ostream.ItemList += ItemList
return acc
......@@ -63,17 +63,17 @@ CaloWaveformDigiAlg::execute(const EventContext& ctx) const {
ATH_CHECK( caloHitHandle.isValid() );
ATH_MSG_DEBUG("Found ReadHandle for CaloHitCollection " << m_caloHitContainerKey);
if (caloHitHandle->size() == 0) {
ATH_MSG_DEBUG("CaloHitCollection found with zero length!");
return StatusCode::SUCCESS;
}
// Find the output waveform container
SG::WriteHandle<RawWaveformContainer> waveformContainerHandle(m_waveformContainerKey, ctx);
ATH_CHECK( waveformContainerHandle.record( std::make_unique<RawWaveformContainer>()) );
ATH_MSG_DEBUG("WaveformsContainer '" << waveformContainerHandle.name() << "' initialized");
if (caloHitHandle->size() == 0) {
ATH_MSG_DEBUG("CaloHitCollection found with zero length!");
return StatusCode::SUCCESS;
}
// Digitise the hits
CHECK( m_digiTool->digitise<CaloHitCollection>(caloHitHandle.ptr(),
waveformContainerHandle.ptr(), m_kernel) );
......
......@@ -62,7 +62,7 @@ from CalypsoConfiguration.AllConfigFlags import ConfigFlags
Configurable.configurableRun3Behavior = True
# Flags for this job
ConfigFlags.Input.isMC = False # Needed to bypass autoconfig
ConfigFlags.Input.isMC = True # Needed to bypass autoconfig
ConfigFlags.IOVDb.DatabaseInstance = "OFLP200" # Use MC conditions for now
ConfigFlags.Input.ProjectName = "mc20"
......@@ -126,6 +126,12 @@ acc.merge(FaserGeometryCfg(ConfigFlags))
from FaserSCT_Digitization.FaserSCT_DigitizationConfigNew import FaserSCT_DigitizationCfg
acc.merge(FaserSCT_DigitizationCfg(ConfigFlags))
from CaloDigiAlgs.CaloDigiAlgsConfig import CaloWaveformDigitizationCfg
acc.merge(CaloWaveformDigitizationCfg(ConfigFlags))
from ScintDigiAlgs.ScintDigiAlgsConfig import ScintWaveformDigitizationCfg
acc.merge(ScintWaveformDigitizationCfg(ConfigFlags))
# from WaveRecAlgs.WaveRecAlgsConfig import WaveformReconstructionCfg
# acc.merge(WaveformReconstructionCfg(ConfigFlags))
......@@ -173,11 +179,11 @@ acc.merge(FaserSCT_DigitizationCfg(ConfigFlags))
# print( acc.getEventAlgo("OutputStreamxAOD").ItemList )
# Hack to avoid problem with our use of MC databases when isMC = False
replicaSvc = acc.getService("DBReplicaSvc")
replicaSvc.COOLSQLiteVetoPattern = ""
replicaSvc.UseCOOLSQLite = True
replicaSvc.UseCOOLFrontier = False
replicaSvc.UseGeomSQLite = True
# replicaSvc = acc.getService("DBReplicaSvc")
# replicaSvc.COOLSQLiteVetoPattern = ""
# replicaSvc.UseCOOLSQLite = True
# replicaSvc.UseCOOLFrontier = False
# replicaSvc.UseGeomSQLite = True
# Configure verbosity
# ConfigFlags.dump()
......
......@@ -21,12 +21,13 @@ def ScintWaveformDigitizationCfg(flags):
acc = ComponentAccumulator()
if not flags.Input.isMC:
return
return acc
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"))
acc.merge(ScintWaveformDigitizationOutputCfg(flags))
return acc
# Return configured digitization algorithm from SIM hits
......@@ -58,7 +59,8 @@ def ScintWaveformDigitizationOutputCfg(flags, **kwargs):
ItemList = [
"RawWaveformContainer#*"
]
acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
# ostream = acc.getEventAlgo("OutputStreamRDO")
# ostream.TakeItemsFromInput = True # Don't know what this does
acc.merge(OutputStreamCfg(flags, "RDO"))
ostream = acc.getEventAlgo("OutputStreamRDO")
ostream.TakeItemsFromInput = True # Copies all data from input file to output
ostream.ItemList += ItemList
return acc
......@@ -64,17 +64,17 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const {
ATH_CHECK( scintHitHandle.isValid() );
ATH_MSG_DEBUG("Found ReadHandle for ScintHitCollection " << m_scintHitContainerKey);
if (scintHitHandle->size() == 0) {
ATH_MSG_DEBUG("ScintHitCollection found with zero length!");
return StatusCode::SUCCESS;
}
// Find the output waveform container
SG::WriteHandle<RawWaveformContainer> waveformContainerHandle(m_waveformContainerKey, ctx);
ATH_CHECK( waveformContainerHandle.record( std::make_unique<RawWaveformContainer>()) );
ATH_MSG_DEBUG("WaveformsContainer '" << waveformContainerHandle.name() << "' initialized");
if (scintHitHandle->size() == 0) {
ATH_MSG_DEBUG("ScintHitCollection found with zero length!");
return StatusCode::SUCCESS;
}
// Digitise the hits
CHECK( m_digiTool->digitise<ScintHitCollection>(scintHitHandle.ptr(),
waveformContainerHandle.ptr(), m_kernel) );
......
......@@ -240,9 +240,10 @@ def FaserSCT_OutputCfg(flags):
if flags.Digitization.TruthOutput:
ItemList += ["TrackerSimDataCollection#*"]
acc.merge(TruthDigitizationOutputCfg(flags))
acc.merge(OutputStreamCfg(flags, "RDO", ItemList))
acc.merge(OutputStreamCfg(flags, "RDO"))
ostream = acc.getEventAlgo("OutputStreamRDO")
ostream.TakeItemsFromInput = True
ostream.ItemList += ItemList
return acc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment