Skip to content
Snippets Groups Projects
Commit 4e1e958d authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'overlay/bcm' into 'master'

Overlay: Add BCM new-style config + fix data overlay

See merge request atlas/athena!34304
parents c3537014 7bb12790
No related branches found
No related tags found
No related merge requests found
Showing
with 398 additions and 73 deletions
...@@ -71,6 +71,8 @@ def BCM_OverlayDigitizationTool(name="BCM_OverlayDigitizationTool",**kwargs): ...@@ -71,6 +71,8 @@ def BCM_OverlayDigitizationTool(name="BCM_OverlayDigitizationTool",**kwargs):
from OverlayCommonAlgs.OverlayFlags import overlayFlags from OverlayCommonAlgs.OverlayFlags import overlayFlags
if overlayFlags.isOverlayMT(): if overlayFlags.isOverlayMT():
kwargs.setdefault("OnlyUseContainerName", False) kwargs.setdefault("OnlyUseContainerName", False)
# Disable the noise
kwargs.setdefault("ModNoise", [ 0., 0., 0., 0., 0., 0., 0., 0. ])
return BCM_DigitizationTool(name,**kwargs) return BCM_DigitizationTool(name,**kwargs)
def BCM_OverlayDigitization(name="BCM_OverlayDigitization",**kwargs): def BCM_OverlayDigitization(name="BCM_OverlayDigitization",**kwargs):
......
...@@ -41,6 +41,10 @@ def BCM_DigitizationToolCfg(flags, name="BCM_DigitizationTool", **kwargs): ...@@ -41,6 +41,10 @@ def BCM_DigitizationToolCfg(flags, name="BCM_DigitizationTool", **kwargs):
if flags.Digitization.PileUpPremixing: if flags.Digitization.PileUpPremixing:
kwargs.setdefault("OutputRDOKey", flags.Overlay.BkgPrefix + "BCM_RDOs") kwargs.setdefault("OutputRDOKey", flags.Overlay.BkgPrefix + "BCM_RDOs")
kwargs.setdefault("OutputSDOKey", flags.Overlay.BkgPrefix + "BCM_SDO_Map") kwargs.setdefault("OutputSDOKey", flags.Overlay.BkgPrefix + "BCM_SDO_Map")
elif flags.Detector.OverlayBCM:
kwargs.setdefault("OnlyUseContainerName", False)
kwargs.setdefault("OutputRDOKey", flags.Overlay.SigPrefix + "BCM_RDOs")
kwargs.setdefault("OutputSDOKey", flags.Overlay.SigPrefix + "BCM_SDO_Map")
else: else:
kwargs.setdefault("OutputRDOKey", "BCM_RDOs") kwargs.setdefault("OutputRDOKey", "BCM_RDOs")
kwargs.setdefault("OutputSDOKey", "BCM_SDO_Map") kwargs.setdefault("OutputSDOKey", "BCM_SDO_Map")
...@@ -88,15 +92,22 @@ def BCM_DigitizationBasicCfg(flags, **kwargs): ...@@ -88,15 +92,22 @@ def BCM_DigitizationBasicCfg(flags, **kwargs):
return acc return acc
def BCM_OverlayDigitizationBasicCfg(flags, **kwargs): def BCM_OverlayDigitizationBasicCfg(flags, name="BCM_OverlayDigitization", **kwargs):
"""Return ComponentAccumulator with BCM Overlay digitization""" """Return ComponentAccumulator with BCM Overlay digitization"""
acc = PixelGeometryCfg(flags) acc = PixelGeometryCfg(flags)
kwargs.setdefault("EvtStore", flags.Overlay.Legacy.EventStore)
if "DigitizationTool" not in kwargs: if "DigitizationTool" not in kwargs:
tool = acc.popToolsAndMerge(BCM_DigitizationToolCfg(flags)) tool = acc.popToolsAndMerge(BCM_DigitizationToolCfg(flags, name="BCM_OverlayDigitizationTool"))
kwargs["DigitizationTool"] = tool kwargs["DigitizationTool"] = tool
if flags.Concurrency.NumThreads > 0:
kwargs.setdefault("Cardinality", flags.Concurrency.NumThreads)
# Set common overlay extra inputs
kwargs.setdefault("ExtraInputs", flags.Overlay.ExtraInputs)
BCM_Digitization = CompFactory.BCM_Digitization BCM_Digitization = CompFactory.BCM_Digitization
acc.addEventAlgo(BCM_Digitization(**kwargs)) acc.addEventAlgo(BCM_Digitization(name, **kwargs))
return acc return acc
......
################################################################################ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Package: InDetOverlay
################################################################################
# Declare the package name: # Declare the package name:
atlas_subdir( InDetOverlay ) atlas_subdir( InDetOverlay )
# Declare the package's dependencies: # External dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
Event/EventOverlay/IDC_OverlayBase
GaudiKernel
InnerDetector/InDetRawEvent/InDetRawData
PRIVATE
Control/CxxUtils
Control/StoreGate
DetectorDescription/IdDictParser
Generators/GeneratorObjects
InnerDetector/InDetRawEvent/InDetBCM_RawData
InnerDetector/InDetDetDescr/InDetIdentifier
InnerDetector/InDetRawEvent/InDetSimData
InnerDetector/InDetRecTools/TRT_ElectronPidTools
Tracking/TrkEvent/TrkTrack
)
#External dependencies:
find_package( CLHEP ) find_package( CLHEP )
find_package( GTest ) find_package( GTest )
...@@ -33,15 +13,20 @@ set( _jobOPath ...@@ -33,15 +13,20 @@ set( _jobOPath
set( _jobOPath "${_jobOPath}:$ENV{JOBOPTSEARCHPATH}" ) set( _jobOPath "${_jobOPath}:$ENV{JOBOPTSEARCHPATH}" )
# Unit Tests # Unit Tests
atlas_add_test( BCMOverlay_test
SOURCES test/BCMOverlay_test.cxx src/BCMOverlay.cxx
INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}
LINK_LIBRARIES AthenaBaseComps GaudiKernel CxxUtils StoreGateLib SGtests GeneratorObjects InDetBCM_RawData InDetSimData ${GTEST_LIBRARIES} )
atlas_add_test( PixelOverlay_test atlas_add_test( PixelOverlay_test
SOURCES test/PixelOverlay_test.cxx src/PixelOverlay.cxx SOURCES test/PixelOverlay_test.cxx src/PixelOverlay.cxx
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} INCLUDE_DIRS ${GTEST_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData CxxUtils StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack ${GTEST_LIBRARIES} ) LINK_LIBRARIES AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData CxxUtils StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack ${GTEST_LIBRARIES} )
atlas_add_test( SCTOverlay_test atlas_add_test( SCTOverlay_test
SOURCES test/SCTOverlay_test.cxx src/SCTOverlay.cxx SOURCES test/SCTOverlay_test.cxx src/SCTOverlay.cxx
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData CxxUtils StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack IdDictParser ${GTEST_LIBRARIES} LINK_LIBRARIES AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData CxxUtils StoreGateLib SGtests GeneratorObjects InDetIdentifier InDetSimData TrkTrack IdDictParser ${GTEST_LIBRARIES}
ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" ) ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
...@@ -50,7 +35,7 @@ atlas_add_component( InDetOverlay ...@@ -50,7 +35,7 @@ atlas_add_component( InDetOverlay
src/*.cxx src/*.cxx
src/components/*.cxx src/components/*.cxx
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData StoreGateLib SGtests GeneratorObjects InDetBCM_RawData InDetIdentifier InDetSimData TrkTrack TRT_ConditionsServicesLib) LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData StoreGateLib SGtests GeneratorObjects InDetBCM_RawData InDetIdentifier InDetSimData TrkTrack TRT_ConditionsServicesLib TRT_ElectronPidToolsLib)
# Install files from the package: # Install files from the package:
atlas_install_headers( InDetOverlay ) atlas_install_headers( InDetOverlay )
...@@ -58,6 +43,10 @@ atlas_install_python_modules( python/*.py ) ...@@ -58,6 +43,10 @@ atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/StoreGateTestCommon.txt ) atlas_install_joboptions( share/StoreGateTestCommon.txt )
# Configuration tests # Configuration tests
atlas_add_test( BCMOverlayConfig_test
SCRIPT test/BCMOverlayConfig_test.py
PROPERTIES TIMEOUT 300 )
atlas_add_test( PixelOverlayConfig_test atlas_add_test( PixelOverlayConfig_test
SCRIPT test/PixelOverlayConfig_test.py SCRIPT test/PixelOverlayConfig_test.py
PROPERTIES TIMEOUT 300 ) PROPERTIES TIMEOUT 300 )
...@@ -69,8 +58,3 @@ atlas_add_test( SCTOverlayConfig_test ...@@ -69,8 +58,3 @@ atlas_add_test( SCTOverlayConfig_test
atlas_add_test( TRTOverlayConfig_test atlas_add_test( TRTOverlayConfig_test
SCRIPT test/TRTOverlayConfig_test.py SCRIPT test/TRTOverlayConfig_test.py
PROPERTIES TIMEOUT 300 ) PROPERTIES TIMEOUT 300 )
atlas_add_test( BCMOverlay_test
SOURCES test/BCMOverlay_test.cxx src/BCMOverlay.cxx
INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel CxxUtils StoreGateLib SGtests GeneratorObjects InDetBCM_RawData InDetSimData ${GTEST_LIBRARIES} )
...@@ -30,14 +30,15 @@ public: ...@@ -30,14 +30,15 @@ public:
virtual StatusCode initialize() override final; virtual StatusCode initialize() override final;
virtual StatusCode execute(const EventContext& ctx) const override final; virtual StatusCode execute(const EventContext& ctx) const override final;
StatusCode overlayContainer(const BCM_RDO_Container *bkgContainer, StatusCode overlayContainer(const EventContext& ctx,
const BCM_RDO_Container *bkgContainer,
const BCM_RDO_Container *signalContainer, const BCM_RDO_Container *signalContainer,
BCM_RDO_Container *outputContainer) const; BCM_RDO_Container *outputContainer) const;
private: private:
BCM_RawData *mergeChannel(const BCM_RawData *bkgRDO, std::unique_ptr<BCM_RawData> mergeChannel(const BCM_RawData *bkgRDO,
const BCM_RawData *signalRDO) const; const BCM_RawData *signalRDO) const;
void overlayPulses(std::vector<std::unique_ptr<BCM_Pulse>>& merged_pulses) const; void overlayPulses(std::vector<std::unique_ptr<BCM_Pulse>>& merged_pulses) const;
...@@ -45,6 +46,9 @@ private: ...@@ -45,6 +46,9 @@ private:
static bool compare(const std::unique_ptr<BCM_Pulse>& a, const std::unique_ptr<BCM_Pulse>& b); static bool compare(const std::unique_ptr<BCM_Pulse>& a, const std::unique_ptr<BCM_Pulse>& b);
Gaudi::Property<bool> m_dataOverlay{ this, "isDataOverlay", false, "Flag to switch between MC and data overlay" };
Gaudi::Property<bool> m_storeAllBCID{ this, "storeAllBCID", false, "Store all BCID" };
SG::ReadHandleKey<BCM_RDO_Container> m_bkgInputKey{ this, "BkgInputKey", "Bkg_BCM_RDOs", "ReadHandleKey for Background Input BCM_RDO_Container" }; SG::ReadHandleKey<BCM_RDO_Container> m_bkgInputKey{ this, "BkgInputKey", "Bkg_BCM_RDOs", "ReadHandleKey for Background Input BCM_RDO_Container" };
SG::ReadHandleKey<BCM_RDO_Container> m_signalInputKey{ this, "SignalInputKey", "Sig_BCM_RDOs", "ReadHandleKey for Signal Input BCM_RDO_Container" }; SG::ReadHandleKey<BCM_RDO_Container> m_signalInputKey{ this, "SignalInputKey", "Sig_BCM_RDOs", "ReadHandleKey for Signal Input BCM_RDO_Container" };
SG::WriteHandleKey<BCM_RDO_Container> m_outputKey{ this, "OutputKey", "BCM_RDOs", "WriteHandleKey for Output BCM_RDO_Container" }; SG::WriteHandleKey<BCM_RDO_Container> m_outputKey{ this, "OutputKey", "BCM_RDOs", "WriteHandleKey for Output BCM_RDO_Container" };
......
"""Define methods to construct configured BCM overlay algorithms
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def BCMRawDataProviderAlgCfg(flags, name="BCMRawDataProvider", **kwargs):
"""Return a ComponentAccumulator for BCM raw data provider"""
# Temporary until available in the central location
acc = ComponentAccumulator()
kwargs.setdefault("RDOKey", flags.Overlay.BkgPrefix + "BCM_RDOs")
BCM_RawDataProvider = CompFactory.BCM_RawDataProvider
alg = BCM_RawDataProvider(name, **kwargs)
acc.addEventAlgo(alg)
return acc
def BCMDataOverlayExtraCfg(flags, **kwargs):
"""Return a ComponentAccumulator with BCM data overlay specifics"""
acc = ComponentAccumulator()
# We need to convert BS to RDO for data overlay
acc.merge(BCMRawDataProviderAlgCfg(flags))
return acc
def BCMOverlayAlgCfg(flags, name="BCMOverlay", **kwargs):
"""Return a ComponentAccumulator for BCMOverlay algorithm"""
acc = ComponentAccumulator()
kwargs.setdefault("BkgInputKey", flags.Overlay.BkgPrefix + "BCM_RDOs")
kwargs.setdefault("SignalInputKey", flags.Overlay.SigPrefix + "BCM_RDOs")
kwargs.setdefault("OutputKey", "BCM_RDOs")
kwargs.setdefault("isDataOverlay", flags.Overlay.DataOverlay)
# Do BCM overlay
BCMOverlay = CompFactory.BCMOverlay
alg = BCMOverlay(name, **kwargs)
acc.addEventAlgo(alg)
# Setup output
if flags.Output.doWriteRDO:
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
"BCM_RDO_Container#BCM_RDOs"
]))
if flags.Output.doWriteRDO_SGNL:
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
"BCM_RDO_Container#" + flags.Overlay.SigPrefix + "BCM_RDOs"
]))
return acc
def BCMTruthOverlayCfg(flags, name="BCMSDOOverlay", **kwargs):
"""Return a ComponentAccumulator for the BCM SDO overlay algorithm"""
acc = ComponentAccumulator()
# We do not need background BCM SDOs
kwargs.setdefault("BkgInputKey", "")
kwargs.setdefault("SignalInputKey",
flags.Overlay.SigPrefix + "BCM_SDO_Map")
kwargs.setdefault("OutputKey", "BCM_SDO_Map")
# Do BCM truth overlay
InDetSDOOverlay = CompFactory.InDetSDOOverlay
alg = InDetSDOOverlay(name, **kwargs)
acc.addEventAlgo(alg)
# Setup output
if flags.Output.doWriteRDO:
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
acc.merge(OutputStreamCfg(flags, "RDO", ItemList=[
"InDetSimDataCollection#BCM_SDO_Map"
]))
if flags.Output.doWriteRDO_SGNL:
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
acc.merge(OutputStreamCfg(flags, "RDO_SGNL", ItemList=[
"InDetSimDataCollection#" + flags.Overlay.SigPrefix + "BCM_SDO_Map"
]))
return acc
def BCMOverlayCfg(flags):
"""Configure and return a ComponentAccumulator for BCM overlay"""
acc = ComponentAccumulator()
# Add data overlay specifics
if flags.Overlay.DataOverlay:
acc.merge(BCMDataOverlayExtraCfg(flags))
# Add BCM overlay digitization algorithm
from BCM_Digitization.BCM_DigitizationConfigNew import BCM_OverlayDigitizationBasicCfg
acc.merge(BCM_OverlayDigitizationBasicCfg(flags))
# Add BCM overlay algorithm
acc.merge(BCMOverlayAlgCfg(flags))
# Add BCM truth overlay
acc.merge(BCMTruthOverlayCfg(flags))
return acc
...@@ -115,6 +115,8 @@ def getTRTSDOOverlay(name="TRTSDOOverlay", **kwargs): ...@@ -115,6 +115,8 @@ def getTRTSDOOverlay(name="TRTSDOOverlay", **kwargs):
def getBCMOverlay(name="BCMOverlay", **kwargs): def getBCMOverlay(name="BCMOverlay", **kwargs):
from OverlayCommonAlgs.OverlayFlags import overlayFlags from OverlayCommonAlgs.OverlayFlags import overlayFlags
kwargs.setdefault("isDataOverlay", overlayFlags.isDataOverlay())
if overlayFlags.isOverlayMT(): if overlayFlags.isOverlayMT():
kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "BCM_RDOs"); kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "BCM_RDOs");
kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "BCM_RDOs"); kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "BCM_RDOs");
......
...@@ -63,13 +63,14 @@ StatusCode BCMOverlay::execute(const EventContext& ctx) const ...@@ -63,13 +63,14 @@ StatusCode BCMOverlay::execute(const EventContext& ctx) const
} }
ATH_MSG_DEBUG("Recorded output BCM RDO container " << outputContainer.name() << " in store " << outputContainer.store()); ATH_MSG_DEBUG("Recorded output BCM RDO container " << outputContainer.name() << " in store " << outputContainer.store());
ATH_CHECK(overlayContainer(bkgContainerPtr, signalContainer.cptr(), outputContainer.ptr())); ATH_CHECK(overlayContainer(ctx, bkgContainerPtr, signalContainer.cptr(), outputContainer.ptr()));
ATH_MSG_DEBUG("execute() end"); ATH_MSG_DEBUG("execute() end");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode BCMOverlay::overlayContainer(const BCM_RDO_Container *bkgContainer, StatusCode BCMOverlay::overlayContainer(const EventContext& ctx,
const BCM_RDO_Container *bkgContainer,
const BCM_RDO_Container *signalContainer, const BCM_RDO_Container *signalContainer,
BCM_RDO_Container *outputContainer) const BCM_RDO_Container *outputContainer) const
{ {
...@@ -88,38 +89,59 @@ StatusCode BCMOverlay::overlayContainer(const BCM_RDO_Container *bkgContainer, ...@@ -88,38 +89,59 @@ StatusCode BCMOverlay::overlayContainer(const BCM_RDO_Container *bkgContainer,
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
size_t containerSize = signalContainer->size(); std::unordered_map<unsigned int, const BCM_RDO_Collection *> bkgChannelMap;
for (const BCM_RDO_Collection *bkgColl : *bkgContainer) {
for (size_t i = 0; i < containerSize; i++) { bkgChannelMap.emplace(bkgColl->getChannel(), bkgColl);
}
const BCM_RDO_Collection *sigColl = signalContainer->at(i); for (const BCM_RDO_Collection *sigColl : *signalContainer) {
const BCM_RDO_Collection *bkgColl = bkgContainer->at(i);
std::unique_ptr<BCM_RDO_Collection> outputColl = std::make_unique<BCM_RDO_Collection>(); auto it = bkgChannelMap.find(sigColl->getChannel());
size_t collectionSize = sigColl->size(); if (it == bkgChannelMap.end()) {
if (collectionSize != bkgColl->size()) { ATH_MSG_ERROR ("No BCM background collection with channel " << sigColl->getChannel());
ATH_MSG_ERROR ("BCM signal and background collection size mismatch");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
if (bkgColl->getChannel() == sigColl->getChannel()) { const BCM_RDO_Collection *bkgColl = it->second;
outputColl->setChannel(sigColl->getChannel()); bkgChannelMap.erase(it);
std::unique_ptr<BCM_RDO_Collection> outputColl = std::make_unique<BCM_RDO_Collection>();
outputColl->setChannel(sigColl->getChannel());
constexpr size_t mcSize{1}; // MC always has exactly one RDO
if (m_dataOverlay.value()) {
// Data has RDOs from more BCIDs, check MC size
if (sigColl->size() != mcSize) {
ATH_MSG_ERROR ("BCM signal collection size mismatch");
return StatusCode::FAILURE;
}
} else { } else {
ATH_MSG_ERROR ("BCM signal and background channel mismatch"); // In case of MC+MC overlay collection sizes are the same
return StatusCode::FAILURE; size_t collectionSize = bkgColl->size();
if (collectionSize != sigColl->size() && collectionSize != mcSize) {
ATH_MSG_ERROR ("BCM signal and background collection size mismatch");
return StatusCode::FAILURE;
}
} }
for (size_t j = 0; j < collectionSize; j++) { int currentBCID = ctx.eventID().bunch_crossing_id();
for (const BCM_RawData *bkgRDO : *bkgColl) {
if (m_dataOverlay.value() && bkgRDO->getBCID() != currentBCID) {
if (m_storeAllBCID.value()) {
outputColl->push_back(new BCM_RawData(bkgRDO->getWord1(), bkgRDO->getWord2()));
}
continue;
}
if (bkgColl->at(j)->getChannel() == sigColl->at(j)->getChannel()) { const BCM_RawData *sigRDO = sigColl->front();
BCM_RawData *mergedRDO = mergeChannel(bkgColl->at(j),sigColl->at(j)); if (bkgRDO->getChannel() == sigRDO->getChannel()) {
if (mergedRDO) outputColl->push_back(mergedRDO); std::unique_ptr<BCM_RawData> mergedRDO = mergeChannel(bkgRDO, sigRDO);
else { if (mergedRDO != nullptr) {
outputColl->push_back(mergedRDO.release());
} else {
ATH_MSG_ERROR ("BCM channel merging failed"); ATH_MSG_ERROR ("BCM channel merging failed");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
} } else {
else {
ATH_MSG_ERROR ("BCM signal and background channel mismatch"); ATH_MSG_ERROR ("BCM signal and background channel mismatch");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
...@@ -131,14 +153,14 @@ StatusCode BCMOverlay::overlayContainer(const BCM_RDO_Container *bkgContainer, ...@@ -131,14 +153,14 @@ StatusCode BCMOverlay::overlayContainer(const BCM_RDO_Container *bkgContainer,
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
BCM_RawData *BCMOverlay::mergeChannel(const BCM_RawData *bkgRDO, std::unique_ptr<BCM_RawData> BCMOverlay::mergeChannel(const BCM_RawData *bkgRDO,
const BCM_RawData *signalRDO) const const BCM_RawData *signalRDO) const
{ {
if (bkgRDO->getPulse1Width()==0) { if (bkgRDO->getPulse1Width()==0) {
return new BCM_RawData(signalRDO->getWord1(), signalRDO->getWord2()); return std::make_unique<BCM_RawData>(signalRDO->getWord1(), signalRDO->getWord2());
} else if (signalRDO->getPulse1Width()==0) { } else if (signalRDO->getPulse1Width()==0) {
return new BCM_RawData(bkgRDO->getWord1(), bkgRDO->getWord2()); return std::make_unique<BCM_RawData>(bkgRDO->getWord1(), bkgRDO->getWord2());
} }
unsigned int bkg_p1 = bkgRDO->getPulse1Position(); unsigned int bkg_p1 = bkgRDO->getPulse1Position();
...@@ -196,12 +218,12 @@ BCM_RawData *BCMOverlay::mergeChannel(const BCM_RawData *bkgRDO, ...@@ -196,12 +218,12 @@ BCM_RawData *BCMOverlay::mergeChannel(const BCM_RawData *bkgRDO,
} }
// Record two earliest pulses into the output RDO // Record two earliest pulses into the output RDO
return new BCM_RawData(signalRDO->getChannel(), return std::make_unique<BCM_RawData>(bkgRDO->getChannel(),
merged_p1, merged_w1, merged_p1, merged_w1,
merged_p2, merged_w2, merged_p2, merged_w2,
signalRDO->getLVL1A(), bkgRDO->getLVL1A(),
signalRDO->getBCID(), bkgRDO->getBCID(),
signalRDO->getLVL1ID()); bkgRDO->getLVL1ID());
} }
void BCMOverlay::overlayPulses(std::vector<std::unique_ptr<BCM_Pulse>>& merged_pulses) const void BCMOverlay::overlayPulses(std::vector<std::unique_ptr<BCM_Pulse>>& merged_pulses) const
...@@ -264,4 +286,4 @@ bool BCMOverlay::compare(const std::unique_ptr<BCM_Pulse>& a, ...@@ -264,4 +286,4 @@ bool BCMOverlay::compare(const std::unique_ptr<BCM_Pulse>& a,
return a->p < b->p; return a->p < b->p;
} }
\ No newline at end of file
#!/usr/bin/env python
"""Run tests on BCMOverlayConfig.py
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
"""
import sys
from AthenaCommon.Configurable import Configurable
from AthenaConfiguration.AllConfigFlags import ConfigFlags
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
from InDetOverlay.BCMOverlayConfig import BCMOverlayCfg
from OverlayConfiguration.OverlayTestHelpers import \
CommonTestArgumentParser, defaultTestFlags, postprocessAndLockFlags, printAndRun
from OverlayCopyAlgs.OverlayCopyAlgsConfig import CopyMcEventCollectionCfg
from xAODEventInfoCnv.xAODEventInfoCnvConfig import EventInfoOverlayCfg
# Configure
Configurable.configurableRun3Behavior = True
# Argument parsing
parser = CommonTestArgumentParser("BCMOverlayConfig_test.py")
args = parser.parse_args()
# Configure
defaultTestFlags(ConfigFlags, args)
postprocessAndLockFlags(ConfigFlags, args)
# Construct our accumulator to run
acc = MainServicesCfg(ConfigFlags)
acc.merge(PoolReadCfg(ConfigFlags))
# Add event and truth overlay (needed downstream)
acc.merge(EventInfoOverlayCfg(ConfigFlags))
acc.merge(CopyMcEventCollectionCfg(ConfigFlags))
# Add BCM overlay
acc.merge(BCMOverlayCfg(ConfigFlags))
# Print and run
sys.exit(printAndRun(acc, ConfigFlags, args))
...@@ -17,8 +17,6 @@ def createOverlayConfigFlags(): ...@@ -17,8 +17,6 @@ def createOverlayConfigFlags():
flags.addFlag("Overlay.SigPrefix", "Sig_") flags.addFlag("Overlay.SigPrefix", "Sig_")
# Overlay extra input dependencies # Overlay extra input dependencies
flags.addFlag("Overlay.ExtraInputs", [("McEventCollection", "TruthEvent")]) flags.addFlag("Overlay.ExtraInputs", [("McEventCollection", "TruthEvent")])
# Name of MC EvtStore to overlay
flags.addFlag("Overlay.Legacy.EventStore", "BkgEvent_0_SG")
return flags return flags
......
...@@ -9,6 +9,7 @@ from AthenaConfiguration.MainServicesConfig import MainServicesCfg ...@@ -9,6 +9,7 @@ from AthenaConfiguration.MainServicesConfig import MainServicesCfg
from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg from AthenaPoolCnvSvc.PoolWriteConfig import PoolWriteCfg
from InDetOverlay.BCMOverlayConfig import BCMOverlayCfg
from InDetOverlay.PixelOverlayConfig import PixelOverlayCfg from InDetOverlay.PixelOverlayConfig import PixelOverlayCfg
from InDetOverlay.SCTOverlayConfig import SCTOverlayCfg from InDetOverlay.SCTOverlayConfig import SCTOverlayCfg
from InDetOverlay.TRTOverlayConfig import TRTOverlayCfg from InDetOverlay.TRTOverlayConfig import TRTOverlayCfg
...@@ -59,6 +60,8 @@ def OverlayMainCfg(configFlags): ...@@ -59,6 +60,8 @@ def OverlayMainCfg(configFlags):
acc.merge(CopyTrackRecordCollectionsCfg(configFlags)) acc.merge(CopyTrackRecordCollectionsCfg(configFlags))
# Inner detector # Inner detector
if configFlags.Detector.OverlayBCM:
acc.merge(BCMOverlayCfg(configFlags))
if configFlags.Detector.OverlayPixel: if configFlags.Detector.OverlayPixel:
acc.merge(PixelOverlayCfg(configFlags)) acc.merge(PixelOverlayCfg(configFlags))
if configFlags.Detector.OverlaySCT: if configFlags.Detector.OverlaySCT:
......
if not 'DetFlags' in dir():
#if you configure one detflag, you're responsible for configuring them all!
from AthenaCommon.DetFlags import DetFlags
DetFlags.all_setOff()
DetFlags.BCM_setOn()
#!/bin/sh
# art-description: MC+data Overlay with MT support, config test
# art-type: grid
# art-include: master/Athena
# art-output: legacyDataOverlayRDO.pool.root
# art-output: dataOverlayRDO.pool.root
# art-output: log.*
# art-output: mem.summary.*
# art-output: mem.full.*
# art-output: runargs.*
# art-output: *.pkl
# art-output: *Config.txt
set -o pipefail
events=2
OverlayBS_tf.py \
--inputBS_SKIMFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/mc15_valid.00200010.overlay_streamsAll_2016_pp_1.skim.DRAW.r8381/DRAW.09331084._000146.pool.root.1 \
--inputHITSFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.OverlaySim/HITS.pool.root \
--outputRDOFile legacyDataOverlayRDO.pool.root \
--maxEvents $events \
--conditionsTag CONDBR2-BLKPA-2016-12 \
--fSampltag LARElecCalibMCfSampl-G496-19213- \
--preExec 'from LArROD.LArRODFlags import larRODFlags;larRODFlags.nSamples.set_Value_and_Lock(4);from LArConditionsCommon.LArCondFlags import larCondFlags; larCondFlags.OFCShapeFolder.set_Value_and_Lock("4samples1phase")' \
--postExec 'outStream.ItemList.remove("xAOD::EventInfoContainer#*"); outStream.ItemList.remove("xAOD::EventInfoAuxContainer#*");' \
--preInclude 'SimulationJobOptions/preInclude.BCMOnlyConfig.py,SimulationJobOptions/preInclude.TruthOnlyConfig.py' \
--postInclude 'EventOverlayJobTransforms/Rt_override_CONDBR2-BLKPA-2015-12.py' \
--ignorePatterns "L1TopoMenuLoader.+ERROR." \
--imf False \
--athenaopts '"--config-only=ConfigLegacy.pkl"'
OverlayBS_tf.py \
--inputBS_SKIMFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/mc15_valid.00200010.overlay_streamsAll_2016_pp_1.skim.DRAW.r8381/DRAW.09331084._000146.pool.root.1 \
--inputHITSFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.OverlaySim/HITS.pool.root \
--outputRDOFile legacyDataOverlayRDO.pool.root \
--maxEvents $events \
--conditionsTag CONDBR2-BLKPA-2016-12 \
--fSampltag LARElecCalibMCfSampl-G496-19213- \
--preExec 'from LArROD.LArRODFlags import larRODFlags;larRODFlags.nSamples.set_Value_and_Lock(4);from LArConditionsCommon.LArCondFlags import larCondFlags; larCondFlags.OFCShapeFolder.set_Value_and_Lock("4samples1phase")' \
--postExec 'job+=CfgMgr.JobOptsDumperAlg(FileName="OverlayLegacyConfig.txt"); outStream.ItemList.remove("xAOD::EventInfoContainer#*"); outStream.ItemList.remove("xAOD::EventInfoAuxContainer#*");' \
--preInclude 'SimulationJobOptions/preInclude.BCMOnlyConfig.py,SimulationJobOptions/preInclude.TruthOnlyConfig.py' \
--postInclude 'EventOverlayJobTransforms/Rt_override_CONDBR2-BLKPA-2015-12.py' \
--ignorePatterns "L1TopoMenuLoader.+ERROR." \
--imf False
rc=$?
echo "art-result: $rc configLegacy"
mv log.OverlayBS log.OverlayLegacy
rc2=-9999
if [ $rc -eq 0 ]
then
OverlayTest.py BCM -d -t 1 -n $events 2>&1 | tee log.OverlayTest
rc2=$?
fi
echo "art-result: $rc2 configNew"
rc3=-9999
if [ $rc2 -eq 0 ]
then
acmd.py diff-root legacyDataOverlayRDO.pool.root dataOverlayRDO.pool.root \
--error-mode resilient --mode=semi-detailed \
--ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref \
xAOD::EventAuxInfo_v2_EventInfoAuxDyn.subEventIndex \
xAOD::EventAuxInfo_v2_EventInfoAuxDyn.subEventTime \
xAOD::EventAuxInfo_v2_EventInfoAuxDyn.subEventType \
xAOD::EventAuxInfo_v2_EventInfoAux.detectorMask0 \
xAOD::EventAuxInfo_v2_EventInfoAux.detectorMask1 \
xAOD::EventAuxInfo_v2_EventInfoAux.detectorMask2 \
xAOD::EventAuxInfo_v2_EventInfoAux.detectorMask3 \
xAOD::EventAuxInfo_v2_EventInfoAux.actualInteractionsPerCrossing \
xAOD::EventAuxInfo_v2_EventInfoAux.averageInteractionsPerCrossing
rc3=$?
fi
echo "art-result: $rc3 comparison"
#!/bin/sh
# art-description: MC+MC Overlay with MT support, config test
# art-type: grid
# art-include: master/Athena
# art-output: legacyMcOverlayRDO.pool.root
# art-output: mcOverlayRDO.pool.root
# art-output: log.*
# art-output: mem.summary.*
# art-output: mem.full.*
# art-output: runargs.*
# art-output: *.pkl
# art-output: *Config.txt
set -o pipefail
events=2
Overlay_tf.py \
--inputHITSFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000425.pool.root.1 \
--inputRDO_BKGFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/PileupPremixing/22.0/v4/RDO.merged-pileup-MT.100events.pool.root \
--outputRDOFile legacyMcOverlayRDO.pool.root \
--maxEvents $events \
--conditionsTag OFLCOND-MC16-SDR-20 \
--geometryVersion ATLAS-R2-2016-01-00-01 \
--preExec 'from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False);' \
--preInclude 'Overlay:SimulationJobOptions/preInclude.BCMOnlyConfig.py,SimulationJobOptions/preInclude.TruthOnlyConfig.py' \
--imf False \
--athenaopts '"--config-only=ConfigLegacy.pkl"'
Overlay_tf.py \
--inputHITSFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000425.pool.root.1 \
--inputRDO_BKGFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/PileupPremixing/22.0/v4/RDO.merged-pileup-MT.100events.pool.root \
--outputRDOFile legacyMcOverlayRDO.pool.root \
--maxEvents $events \
--conditionsTag OFLCOND-MC16-SDR-20 \
--geometryVersion ATLAS-R2-2016-01-00-01 \
--preExec 'from LArROD.LArRODFlags import larRODFlags;larRODFlags.NumberOfCollisions.set_Value_and_Lock(20);larRODFlags.nSamples.set_Value_and_Lock(4);larRODFlags.doOFCPileupOptimization.set_Value_and_Lock(True);larRODFlags.firstSample.set_Value_and_Lock(0);larRODFlags.useHighestGainAutoCorr.set_Value_and_Lock(True); from LArDigitization.LArDigitizationFlags import jobproperties;jobproperties.LArDigitizationFlags.useEmecIwHighGain.set_Value_and_Lock(False);' \
--postExec 'job+=CfgMgr.JobOptsDumperAlg(FileName="OverlayLegacyConfig.txt");' \
--preInclude 'Overlay:SimulationJobOptions/preInclude.BCMOnlyConfig.py,SimulationJobOptions/preInclude.TruthOnlyConfig.py' \
--imf False
rc=$?
echo "art-result: $rc configLegacy"
mv log.Overlay log.OverlayLegacy
rc2=-9999
if [ $rc -eq 0 ]
then
OverlayTest.py BCM -t 1 -n $events 2>&1 | tee log.OverlayTest
rc2=$?
fi
echo "art-result: $rc2 configNew"
rc3=-9999
if [ $rc2 -eq 0 ]
then
acmd.py diff-root legacyMcOverlayRDO.pool.root mcOverlayRDO.pool.root --error-mode resilient --mode=semi-detailed --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref
rc3=$?
fi
echo "art-result: $rc3 comparison"
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