Skip to content
Snippets Groups Projects
Commit c22c3fb4 authored by Eric Torrence's avatar Eric Torrence
Browse files

Add channels to waveform digi

parent 102c609f
No related branches found
No related tags found
No related merge requests found
Showing
with 35 additions and 28 deletions
......@@ -9,7 +9,9 @@ atlas_subdir( CaloDigiAlgs )
atlas_add_component( CaloDigiAlgs
src/*.cxx src/*.h
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps Identifier FaserCaloIdentifier StoreGateLib WaveRawEvent FaserCaloSimEvent WaveDigiToolsLib)
LINK_LIBRARIES AthenaBaseComps Identifier FaserCaloIdentifier
WaveformConditionsToolsLib StoreGateLib WaveRawEvent
FaserCaloSimEvent WaveDigiToolsLib)
atlas_install_python_modules( python/*.py )
......@@ -6,6 +6,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
from WaveformConditionsTools.WaveformCableMappingConfig import WaveformCableMappingCfg
# One stop shopping for normal FASER data
def CaloWaveformDigitizationCfg(flags):
......@@ -17,6 +18,8 @@ def CaloWaveformDigitizationCfg(flags):
acc.merge(CaloWaveformDigiCfg(flags, "CaloWaveformDigiAlg"))
acc.merge(CaloWaveformDigitizationOutputCfg(flags))
acc.merge(WaveformCableMappingCfg(flags))
return acc
# Return configured digitization algorithm from SIM hits
......@@ -54,6 +57,8 @@ def CaloWaveformDigitizationOutputCfg(flags, **kwargs):
]
acc.merge(OutputStreamCfg(flags, "RDO"))
ostream = acc.getEventAlgo("OutputStreamRDO")
ostream.TakeItemsFromInput = True # Copies all data from input file to output
# ostream.TakeItemsFromInput = True # Copies all data from input file to output
# ostream.TakeItemsFromInput = False
# Try turning this off
ostream.ItemList += ItemList
return acc
......@@ -20,6 +20,7 @@ CaloWaveformDigiAlg::initialize() {
// Initalize tools
ATH_CHECK( m_digiTool.retrieve() );
ATH_CHECK( m_mappingTool.retrieve() );
// Set key to read waveform from
ATH_CHECK( m_caloHitContainerKey.initialize() );
......@@ -113,6 +114,7 @@ CaloWaveformDigiAlg::execute(const EventContext& ctx) const {
RawWaveform* wfm = new RawWaveform();
wfm->setWaveform(0, w.second);
wfm->setIdentifier(w.first);
wfm->setChannel(m_mappingTool->getChannelMapping(w.first));
wfm->setSamples(nsamples);
waveformContainerHandle->push_back(wfm);
}
......
......@@ -10,6 +10,7 @@
// Tool classes
#include "WaveDigiTools/IWaveformDigitisationTool.h"
#include "WaveformConditionsTools/IWaveformCableMappingTool.h"
// Handles
#include "StoreGate/ReadHandleKey.h"
......@@ -79,6 +80,11 @@ class CaloWaveformDigiAlg : public AthReentrantAlgorithm {
ToolHandle<IWaveformDigitisationTool> m_digiTool
{this, "WaveformDigitisationTool", "WaveformDigitisationTool"};
/**
* @name Mapping tool
*/
ToolHandle<IWaveformCableMappingTool> m_mappingTool
{this, "WaveformCableMappingTool", "WaveformCableMappingTool"};
/**
* @name Input HITS using SG::ReadHandleKey
......
......@@ -9,7 +9,9 @@ atlas_subdir( ScintDigiAlgs )
atlas_add_component( ScintDigiAlgs
src/*.cxx src/*.h
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps Identifier ScintIdentifier StoreGateLib WaveRawEvent ScintSimEvent WaveDigiToolsLib)
LINK_LIBRARIES AthenaBaseComps Identifier ScintIdentifier
WaveformConditionsToolsLib StoreGateLib WaveRawEvent
ScintSimEvent WaveDigiToolsLib)
atlas_install_python_modules( python/*.py )
......@@ -5,6 +5,8 @@ from AthenaConfiguration.ComponentFactory import CompFactory
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
from WaveformConditionsTools.WaveformCableMappingConfig import WaveformCableMappingCfg
# Crystallball parameter dictionary used in simulated digitized wave reconstruction.
# Crystalball function Parameters estimated from Deion's slides uploaded at
# https://indico.cern.ch/event/1099652/contributions/4626975/attachments/2352595/4013927/Faser-Physics-run3933-plots.pdf (20/01/2022)
......@@ -35,6 +37,7 @@ def ScintWaveformDigitizationCfg(flags):
acc.merge(ScintWaveformDigiCfg(flags, "VetoWaveformDigiAlg", "Veto"))
acc.merge(ScintWaveformDigiCfg(flags, "PreshowerWaveformDigiAlg", "Preshower"))
acc.merge(ScintWaveformDigitizationOutputCfg(flags))
acc.merge(WaveformCableMappingCfg(flags))
return acc
# Return configured digitization algorithm from SIM hits
......@@ -72,6 +75,7 @@ def ScintWaveformDigitizationOutputCfg(flags, **kwargs):
]
acc.merge(OutputStreamCfg(flags, "RDO"))
ostream = acc.getEventAlgo("OutputStreamRDO")
ostream.TakeItemsFromInput = True # Copies all data from input file to output
# ostream.TakeItemsFromInput = True # Copies all data from input file to output
# ostream.TakeItemsFromInput = False
ostream.ItemList += ItemList
return acc
......@@ -17,6 +17,7 @@ ScintWaveformDigiAlg::initialize() {
// Initalize tools
ATH_CHECK( m_digiTool.retrieve() );
ATH_CHECK( m_mappingTool.retrieve() );
// Set key to read waveform from
ATH_CHECK( m_scintHitContainerKey.initialize() );
......@@ -118,6 +119,7 @@ ScintWaveformDigiAlg::execute(const EventContext& ctx) const {
RawWaveform* wfm = new RawWaveform();
wfm->setWaveform(0, w.second);
wfm->setIdentifier(w.first);
wfm->setChannel(m_mappingTool->getChannelMapping(w.first));
wfm->setSamples(nsamples);
waveformContainerHandle->push_back(wfm);
}
......
......@@ -10,6 +10,7 @@
// Tool classes
#include "WaveDigiTools/IWaveformDigitisationTool.h"
#include "WaveformConditionsTools/IWaveformCableMappingTool.h"
// Handles
#include "StoreGate/ReadHandleKey.h"
......@@ -92,6 +93,11 @@ class ScintWaveformDigiAlg : public AthReentrantAlgorithm {
ToolHandle<IWaveformDigitisationTool> m_digiTool
{this, "WaveformDigitisationTool", "WaveformDigitisationTool"};
/**
* @name Mapping tool
*/
ToolHandle<IWaveformCableMappingTool> m_mappingTool
{this, "WaveformCableMappingTool", "WaveformCableMappingTool"};
/**
* @name Input HITS using SG::ReadHandleKey
......
......@@ -82,7 +82,7 @@ public:
// Const methods:
///////////////////////////////////////////////////////////////////
// This is the HitId, used in Geant, this is not the detector Identifier
// This is the HitId, used in Geant. This is not the detector Identifier
unsigned int identify() const;
// This is the detector readout Identifier (pmt Identifier)
......
......@@ -242,7 +242,7 @@ def FaserSCT_OutputCfg(flags):
acc.merge(TruthDigitizationOutputCfg(flags))
acc.merge(OutputStreamCfg(flags, "RDO"))
ostream = acc.getEventAlgo("OutputStreamRDO")
ostream.TakeItemsFromInput = True
#ostream.TakeItemsFromInput = True # Don't write hits to RDO by default
ostream.ItemList += ItemList
return acc
......
......@@ -19,20 +19,6 @@ def WaveformReconstructionCfg(flags):
if not flags.Input.isMC:
acc.merge(WaveformClockRecCfg(flags, "ClockRecAlg"))
if flags.Input.isMC:
if "TB" not in flags.GeoModel.FaserVersion:
acc.merge(PseudoScintHitToWaveformRecCfg(flags, "PseudoTriggerHitWaveformRecAlg", "Trigger"))
acc.merge(PseudoScintHitToWaveformRecCfg(flags, "PseudoVetoHitToWaveformRecAlg", "Veto"))
acc.merge(PseudoScintHitToWaveformRecCfg(flags, "PseudoPresehowerHitWaveformRecAlg", "Preshower"))
acc.merge(PseudoCaloHitToWaveformRecCfg(flags, "PseudoCaloHitWaveformRecAlg"))
# Also need cable mapping here
from WaveformConditionsTools.WaveformCableMappingConfig import WaveformCableMappingCfg
acc.merge(WaveformCableMappingCfg(flags))
return acc
acc.merge(WaveformHitRecCfg(flags, "TriggerWaveformRecAlg", "Trigger"))
acc.merge(WaveformHitRecCfg(flags, "VetoWaveformRecAlg", "Veto"))
acc.merge(WaveformHitRecCfg(flags, "PreshowerWaveformRecAlg", "Preshower"))
......
......@@ -25,7 +25,6 @@ PseudoSimToWaveformRecTool::initialize() {
ATH_MSG_INFO( name() << "::initalize()" );
ATH_CHECK( m_mappingTool.retrieve() );
// ATH_CHECK( m_timingTool.retrieve() );
return StatusCode::SUCCESS;
}
......@@ -49,15 +48,12 @@ PseudoSimToWaveformRecTool::make_hits(const std::map<Identifier, float>& sums,
xAOD::WaveformHit* hit = new xAOD::WaveformHit();
container->push_back(hit);
// offset = m_timingTool->triggerTimeOffset(hit->channel());
hit->set_identifier(id.first);
hit->set_channel(m_mappingTool->getChannelMapping(id.first));
hit->set_peak(0);
hit->set_mean(0);
hit->set_width(0);
hit->set_integral(id.second);
// hit->set_localtime(trigger_time + offset);
hit->set_localtime(0);
hit->set_trigger_time(0);
hit->set_raw_peak(0);
......
......@@ -15,7 +15,6 @@
// Tool classes
#include "WaveformConditionsTools/IWaveformCableMappingTool.h"
#include "WaveformConditionsTools/IWaveformTimingTool.h"
//Gaudi
#include "GaudiKernel/ToolHandle.h"
......@@ -39,9 +38,6 @@ class PseudoSimToWaveformRecTool: public extends<AthAlgTool, IPseudoSimToWavefor
ToolHandle<IWaveformCableMappingTool> m_mappingTool
{this, "WaveformCableMappingTool", "WaveformCableMappingTool"};
//ToolHandle<IWaveformTimingTool> m_timingTool
// {this, "WaveformTimingTool", "WaveformTimingTool"};
};
#endif // WAVERECTOOLS_PSEUDOSIMTOWAVEFORMRECTOOL_H
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